mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2024-11-22 08:13:47 +00:00
TextSources replacements
This commit is contained in:
parent
4d3cad16a4
commit
d3cb44490b
@ -25,6 +25,7 @@ __All the `tgbotapi.extensions.*` packages have been removed__
|
||||
* **Replaces of `MessageContent`. Migrations:**
|
||||
* `dev.inmo.tgbotapi.types.message.content.abstracts` -> `dev.inmo.tgbotapi.types.message.content`
|
||||
* `dev.inmo.tgbotapi.types.message.content.media` -> `dev.inmo.tgbotapi.types.message.content`
|
||||
* **Replaces of `TextSource`s. Migrations:** `dev.inmo.tgbotapi.types.MessageEntity.textsources` -> `dev.inmo.tgbotapi.types.message.textsources`
|
||||
* **`InvoiceContent` has been replaced: `dev.inmo.tgbotapi.types.message.payments.InvoiceContent` -> `dev.inmo.tgbotapi.types.message.content.InvoiceContent`**
|
||||
* **`PossiblySentViaBotCommonMessage` has been replaced: `dev.inmo.tgbotapi.types.message.content.abstracts.PossiblySentViaBotCommonMessage` -> `dev.inmo.tgbotapi.types.message.abstracts.PossiblySentViaBotCommonMessage`**
|
||||
* Constructor of `UnknownInlineKeyboardButton` is not internal and can be created with any `json` ([#563](https://github.com/InsanusMokrassar/TelegramBotAPI/issues/563))
|
||||
|
@ -4,8 +4,8 @@ import dev.inmo.tgbotapi.CommonAbstracts.TextedWithTextSources
|
||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||
import dev.inmo.tgbotapi.requests.edit.caption.EditChatMessageCaption
|
||||
import dev.inmo.tgbotapi.types.ChatIdentifier
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSource
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSourcesList
|
||||
import dev.inmo.tgbotapi.types.message.textsources.TextSource
|
||||
import dev.inmo.tgbotapi.types.message.textsources.TextSourcesList
|
||||
import dev.inmo.tgbotapi.types.MessageIdentifier
|
||||
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
||||
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
|
||||
|
@ -3,7 +3,7 @@ package dev.inmo.tgbotapi.extensions.api.edit.caption
|
||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||
import dev.inmo.tgbotapi.requests.edit.caption.EditInlineMessageCaption
|
||||
import dev.inmo.tgbotapi.types.InlineMessageIdentifier
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSourcesList
|
||||
import dev.inmo.tgbotapi.types.message.textsources.TextSourcesList
|
||||
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
||||
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
|
||||
|
||||
|
@ -3,7 +3,7 @@ package dev.inmo.tgbotapi.extensions.api.edit.text
|
||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||
import dev.inmo.tgbotapi.requests.edit.text.EditChatMessageText
|
||||
import dev.inmo.tgbotapi.types.ChatIdentifier
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSourcesList
|
||||
import dev.inmo.tgbotapi.types.message.textsources.TextSourcesList
|
||||
import dev.inmo.tgbotapi.types.MessageIdentifier
|
||||
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
||||
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
|
||||
|
@ -3,7 +3,7 @@ package dev.inmo.tgbotapi.extensions.api.edit.text
|
||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||
import dev.inmo.tgbotapi.requests.edit.text.EditInlineMessageText
|
||||
import dev.inmo.tgbotapi.types.InlineMessageIdentifier
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSourcesList
|
||||
import dev.inmo.tgbotapi.types.message.textsources.TextSourcesList
|
||||
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
||||
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
|
||||
|
||||
|
@ -3,7 +3,7 @@ package dev.inmo.tgbotapi.extensions.api.send
|
||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||
import dev.inmo.tgbotapi.requests.send.CopyMessage
|
||||
import dev.inmo.tgbotapi.types.ChatIdentifier
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSourcesList
|
||||
import dev.inmo.tgbotapi.types.message.textsources.TextSourcesList
|
||||
import dev.inmo.tgbotapi.types.MessageIdentifier
|
||||
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
||||
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
|
||||
|
@ -4,7 +4,7 @@ import dev.inmo.tgbotapi.bot.TelegramBot
|
||||
import dev.inmo.tgbotapi.extensions.api.send.media.sendMediaGroup
|
||||
import dev.inmo.tgbotapi.types.ChatIdentifier
|
||||
import dev.inmo.tgbotapi.types.media.*
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSourcesList
|
||||
import dev.inmo.tgbotapi.types.message.textsources.TextSourcesList
|
||||
import dev.inmo.tgbotapi.types.MessageIdentifier
|
||||
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
||||
import dev.inmo.tgbotapi.types.chat.Chat
|
||||
|
@ -10,8 +10,8 @@ import dev.inmo.tgbotapi.requests.abstracts.InputFile
|
||||
import dev.inmo.tgbotapi.requests.send.media.rawSendingMediaGroupsWarning
|
||||
import dev.inmo.tgbotapi.types.*
|
||||
import dev.inmo.tgbotapi.types.media.*
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSource
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSourcesList
|
||||
import dev.inmo.tgbotapi.types.message.textsources.TextSource
|
||||
import dev.inmo.tgbotapi.types.message.textsources.TextSourcesList
|
||||
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
||||
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
|
||||
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
|
||||
|
@ -3,7 +3,7 @@ package dev.inmo.tgbotapi.extensions.api.send
|
||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||
import dev.inmo.tgbotapi.requests.send.SendTextMessage
|
||||
import dev.inmo.tgbotapi.types.ChatIdentifier
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSourcesList
|
||||
import dev.inmo.tgbotapi.types.message.textsources.TextSourcesList
|
||||
import dev.inmo.tgbotapi.types.MessageIdentifier
|
||||
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
||||
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
|
||||
|
@ -4,7 +4,7 @@ import dev.inmo.tgbotapi.bot.TelegramBot
|
||||
import dev.inmo.tgbotapi.requests.abstracts.InputFile
|
||||
import dev.inmo.tgbotapi.requests.send.media.SendAnimation
|
||||
import dev.inmo.tgbotapi.types.ChatIdentifier
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSourcesList
|
||||
import dev.inmo.tgbotapi.types.message.textsources.TextSourcesList
|
||||
import dev.inmo.tgbotapi.types.MessageIdentifier
|
||||
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
||||
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
|
||||
|
@ -4,7 +4,7 @@ import dev.inmo.tgbotapi.bot.TelegramBot
|
||||
import dev.inmo.tgbotapi.requests.abstracts.InputFile
|
||||
import dev.inmo.tgbotapi.requests.send.media.SendAudio
|
||||
import dev.inmo.tgbotapi.types.ChatIdentifier
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSourcesList
|
||||
import dev.inmo.tgbotapi.types.message.textsources.TextSourcesList
|
||||
import dev.inmo.tgbotapi.types.MessageIdentifier
|
||||
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
||||
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
|
||||
|
@ -4,7 +4,7 @@ import dev.inmo.tgbotapi.bot.TelegramBot
|
||||
import dev.inmo.tgbotapi.requests.abstracts.InputFile
|
||||
import dev.inmo.tgbotapi.requests.send.media.SendDocument
|
||||
import dev.inmo.tgbotapi.types.ChatIdentifier
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSourcesList
|
||||
import dev.inmo.tgbotapi.types.message.textsources.TextSourcesList
|
||||
import dev.inmo.tgbotapi.types.MessageIdentifier
|
||||
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
||||
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
|
||||
|
@ -4,7 +4,7 @@ import dev.inmo.tgbotapi.bot.TelegramBot
|
||||
import dev.inmo.tgbotapi.requests.abstracts.InputFile
|
||||
import dev.inmo.tgbotapi.requests.send.media.SendPhoto
|
||||
import dev.inmo.tgbotapi.types.ChatIdentifier
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSourcesList
|
||||
import dev.inmo.tgbotapi.types.message.textsources.TextSourcesList
|
||||
import dev.inmo.tgbotapi.types.MessageIdentifier
|
||||
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
||||
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
|
||||
|
@ -4,7 +4,7 @@ import dev.inmo.tgbotapi.bot.TelegramBot
|
||||
import dev.inmo.tgbotapi.requests.abstracts.InputFile
|
||||
import dev.inmo.tgbotapi.requests.send.media.SendVideo
|
||||
import dev.inmo.tgbotapi.types.ChatIdentifier
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSourcesList
|
||||
import dev.inmo.tgbotapi.types.message.textsources.TextSourcesList
|
||||
import dev.inmo.tgbotapi.types.MessageIdentifier
|
||||
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
||||
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
|
||||
|
@ -4,7 +4,7 @@ import dev.inmo.tgbotapi.bot.TelegramBot
|
||||
import dev.inmo.tgbotapi.requests.abstracts.InputFile
|
||||
import dev.inmo.tgbotapi.requests.send.media.SendVoice
|
||||
import dev.inmo.tgbotapi.types.ChatIdentifier
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSourcesList
|
||||
import dev.inmo.tgbotapi.types.message.textsources.TextSourcesList
|
||||
import dev.inmo.tgbotapi.types.MessageIdentifier
|
||||
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
||||
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
|
||||
|
@ -4,7 +4,7 @@ import dev.inmo.tgbotapi.bot.TelegramBot
|
||||
import dev.inmo.tgbotapi.requests.send.polls.SendQuizPoll
|
||||
import dev.inmo.tgbotapi.requests.send.polls.SendRegularPoll
|
||||
import dev.inmo.tgbotapi.types.ChatIdentifier
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSourcesList
|
||||
import dev.inmo.tgbotapi.types.message.textsources.TextSourcesList
|
||||
import dev.inmo.tgbotapi.types.MessageIdentifier
|
||||
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
||||
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
|
||||
|
@ -1,6 +1,6 @@
|
||||
package dev.inmo.tgbotapi.CommonAbstracts
|
||||
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSource
|
||||
import dev.inmo.tgbotapi.types.message.textsources.TextSource
|
||||
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
||||
|
||||
interface Texted {
|
||||
|
@ -3,13 +3,15 @@ package dev.inmo.tgbotapi.requests.edit.caption
|
||||
import dev.inmo.tgbotapi.requests.edit.abstracts.*
|
||||
import dev.inmo.tgbotapi.requests.edit.media.MediaContentMessageResultDeserializer
|
||||
import dev.inmo.tgbotapi.types.*
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.*
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSourcesList
|
||||
import dev.inmo.tgbotapi.types.message.textsources.TextSourcesList
|
||||
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
||||
import dev.inmo.tgbotapi.types.ParseMode.parseModeField
|
||||
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
|
||||
import dev.inmo.tgbotapi.types.message.*
|
||||
import dev.inmo.tgbotapi.types.message.RawMessageEntity
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage
|
||||
import dev.inmo.tgbotapi.types.message.content.MediaContent
|
||||
import dev.inmo.tgbotapi.types.message.toRawMessageEntities
|
||||
import dev.inmo.tgbotapi.utils.extensions.makeString
|
||||
import kotlinx.serialization.*
|
||||
|
||||
|
@ -2,11 +2,13 @@ package dev.inmo.tgbotapi.requests.edit.caption
|
||||
|
||||
import dev.inmo.tgbotapi.requests.edit.abstracts.*
|
||||
import dev.inmo.tgbotapi.types.*
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.*
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSourcesList
|
||||
import dev.inmo.tgbotapi.types.message.textsources.TextSourcesList
|
||||
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
||||
import dev.inmo.tgbotapi.types.ParseMode.parseModeField
|
||||
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
|
||||
import dev.inmo.tgbotapi.types.message.*
|
||||
import dev.inmo.tgbotapi.types.message.RawMessageEntity
|
||||
import dev.inmo.tgbotapi.types.message.toRawMessageEntities
|
||||
import dev.inmo.tgbotapi.utils.extensions.makeString
|
||||
import kotlinx.serialization.*
|
||||
|
||||
|
@ -3,13 +3,15 @@ package dev.inmo.tgbotapi.requests.edit.text
|
||||
import dev.inmo.tgbotapi.requests.edit.abstracts.*
|
||||
import dev.inmo.tgbotapi.requests.send.TextContentMessageResultDeserializer
|
||||
import dev.inmo.tgbotapi.types.*
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.*
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSourcesList
|
||||
import dev.inmo.tgbotapi.types.message.textsources.TextSourcesList
|
||||
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
||||
import dev.inmo.tgbotapi.types.ParseMode.parseModeField
|
||||
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
|
||||
import dev.inmo.tgbotapi.types.message.*
|
||||
import dev.inmo.tgbotapi.types.message.RawMessageEntity
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage
|
||||
import dev.inmo.tgbotapi.types.message.content.TextContent
|
||||
import dev.inmo.tgbotapi.types.message.toRawMessageEntities
|
||||
import dev.inmo.tgbotapi.utils.extensions.makeString
|
||||
import kotlinx.serialization.*
|
||||
|
||||
|
@ -2,11 +2,13 @@ package dev.inmo.tgbotapi.requests.edit.text
|
||||
|
||||
import dev.inmo.tgbotapi.requests.edit.abstracts.*
|
||||
import dev.inmo.tgbotapi.types.*
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.*
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSourcesList
|
||||
import dev.inmo.tgbotapi.types.message.textsources.TextSourcesList
|
||||
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
||||
import dev.inmo.tgbotapi.types.ParseMode.parseModeField
|
||||
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
|
||||
import dev.inmo.tgbotapi.types.message.*
|
||||
import dev.inmo.tgbotapi.types.message.RawMessageEntity
|
||||
import dev.inmo.tgbotapi.types.message.toRawMessageEntities
|
||||
import dev.inmo.tgbotapi.utils.extensions.makeString
|
||||
import kotlinx.serialization.*
|
||||
|
||||
|
@ -6,11 +6,13 @@ import dev.inmo.tgbotapi.CommonAbstracts.types.ProtectContent
|
||||
import dev.inmo.tgbotapi.requests.abstracts.SimpleRequest
|
||||
import dev.inmo.tgbotapi.requests.send.abstracts.ReplyingMarkupSendMessageRequest
|
||||
import dev.inmo.tgbotapi.types.*
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.*
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSource
|
||||
import dev.inmo.tgbotapi.types.message.textsources.TextSource
|
||||
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
||||
import dev.inmo.tgbotapi.types.ParseMode.parseModeField
|
||||
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
|
||||
import dev.inmo.tgbotapi.types.message.*
|
||||
import dev.inmo.tgbotapi.types.message.RawMessageEntity
|
||||
import dev.inmo.tgbotapi.types.message.toRawMessageEntities
|
||||
import dev.inmo.tgbotapi.utils.extensions.makeString
|
||||
import kotlinx.serialization.*
|
||||
|
||||
|
@ -3,14 +3,16 @@ package dev.inmo.tgbotapi.requests.send
|
||||
import dev.inmo.tgbotapi.CommonAbstracts.types.DisableWebPagePreview
|
||||
import dev.inmo.tgbotapi.requests.send.abstracts.*
|
||||
import dev.inmo.tgbotapi.types.*
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.*
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSourcesList
|
||||
import dev.inmo.tgbotapi.types.message.textsources.TextSourcesList
|
||||
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
||||
import dev.inmo.tgbotapi.types.ParseMode.parseModeField
|
||||
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
|
||||
import dev.inmo.tgbotapi.types.message.*
|
||||
import dev.inmo.tgbotapi.types.message.RawMessageEntity
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.TelegramBotAPIMessageDeserializationStrategyClass
|
||||
import dev.inmo.tgbotapi.types.message.content.TextContent
|
||||
import dev.inmo.tgbotapi.types.message.toRawMessageEntities
|
||||
import dev.inmo.tgbotapi.utils.extensions.makeString
|
||||
import dev.inmo.tgbotapi.utils.throwRangeError
|
||||
import kotlinx.serialization.*
|
||||
|
@ -4,14 +4,16 @@ import dev.inmo.tgbotapi.requests.abstracts.*
|
||||
import dev.inmo.tgbotapi.requests.send.abstracts.*
|
||||
import dev.inmo.tgbotapi.requests.send.media.base.*
|
||||
import dev.inmo.tgbotapi.types.*
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.*
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSourcesList
|
||||
import dev.inmo.tgbotapi.types.message.textsources.TextSourcesList
|
||||
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
||||
import dev.inmo.tgbotapi.types.ParseMode.parseModeField
|
||||
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
|
||||
import dev.inmo.tgbotapi.types.message.*
|
||||
import dev.inmo.tgbotapi.types.message.RawMessageEntity
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.TelegramBotAPIMessageDeserializationStrategyClass
|
||||
import dev.inmo.tgbotapi.types.message.content.AnimationContent
|
||||
import dev.inmo.tgbotapi.types.message.toRawMessageEntities
|
||||
import dev.inmo.tgbotapi.utils.extensions.makeString
|
||||
import dev.inmo.tgbotapi.utils.mapOfNotNull
|
||||
import dev.inmo.tgbotapi.utils.throwRangeError
|
||||
|
@ -5,14 +5,16 @@ import dev.inmo.tgbotapi.requests.abstracts.*
|
||||
import dev.inmo.tgbotapi.requests.send.abstracts.*
|
||||
import dev.inmo.tgbotapi.requests.send.media.base.*
|
||||
import dev.inmo.tgbotapi.types.*
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.*
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSource
|
||||
import dev.inmo.tgbotapi.types.message.textsources.TextSource
|
||||
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
||||
import dev.inmo.tgbotapi.types.ParseMode.parseModeField
|
||||
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
|
||||
import dev.inmo.tgbotapi.types.message.*
|
||||
import dev.inmo.tgbotapi.types.message.RawMessageEntity
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.TelegramBotAPIMessageDeserializationStrategyClass
|
||||
import dev.inmo.tgbotapi.types.message.content.AudioContent
|
||||
import dev.inmo.tgbotapi.types.message.toRawMessageEntities
|
||||
import dev.inmo.tgbotapi.utils.extensions.makeString
|
||||
import dev.inmo.tgbotapi.utils.mapOfNotNull
|
||||
import dev.inmo.tgbotapi.utils.throwRangeError
|
||||
|
@ -4,14 +4,16 @@ import dev.inmo.tgbotapi.requests.abstracts.*
|
||||
import dev.inmo.tgbotapi.requests.send.abstracts.*
|
||||
import dev.inmo.tgbotapi.requests.send.media.base.*
|
||||
import dev.inmo.tgbotapi.types.*
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.*
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSourcesList
|
||||
import dev.inmo.tgbotapi.types.message.textsources.TextSourcesList
|
||||
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
||||
import dev.inmo.tgbotapi.types.ParseMode.parseModeField
|
||||
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
|
||||
import dev.inmo.tgbotapi.types.message.*
|
||||
import dev.inmo.tgbotapi.types.message.RawMessageEntity
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.TelegramBotAPIMessageDeserializationStrategyClass
|
||||
import dev.inmo.tgbotapi.types.message.content.DocumentContent
|
||||
import dev.inmo.tgbotapi.types.message.toRawMessageEntities
|
||||
import dev.inmo.tgbotapi.utils.extensions.makeString
|
||||
import dev.inmo.tgbotapi.utils.mapOfNotNull
|
||||
import dev.inmo.tgbotapi.utils.throwRangeError
|
||||
|
@ -4,14 +4,16 @@ import dev.inmo.tgbotapi.requests.abstracts.*
|
||||
import dev.inmo.tgbotapi.requests.send.abstracts.*
|
||||
import dev.inmo.tgbotapi.requests.send.media.base.*
|
||||
import dev.inmo.tgbotapi.types.*
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.*
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSourcesList
|
||||
import dev.inmo.tgbotapi.types.message.textsources.TextSourcesList
|
||||
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
||||
import dev.inmo.tgbotapi.types.ParseMode.parseModeField
|
||||
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
|
||||
import dev.inmo.tgbotapi.types.message.*
|
||||
import dev.inmo.tgbotapi.types.message.RawMessageEntity
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.TelegramBotAPIMessageDeserializationStrategyClass
|
||||
import dev.inmo.tgbotapi.types.message.content.PhotoContent
|
||||
import dev.inmo.tgbotapi.types.message.toRawMessageEntities
|
||||
import dev.inmo.tgbotapi.utils.extensions.makeString
|
||||
import dev.inmo.tgbotapi.utils.throwRangeError
|
||||
import kotlinx.serialization.*
|
||||
|
@ -4,14 +4,16 @@ import dev.inmo.tgbotapi.requests.abstracts.*
|
||||
import dev.inmo.tgbotapi.requests.send.abstracts.*
|
||||
import dev.inmo.tgbotapi.requests.send.media.base.*
|
||||
import dev.inmo.tgbotapi.types.*
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.*
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSourcesList
|
||||
import dev.inmo.tgbotapi.types.message.textsources.TextSourcesList
|
||||
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
||||
import dev.inmo.tgbotapi.types.ParseMode.parseModeField
|
||||
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
|
||||
import dev.inmo.tgbotapi.types.message.*
|
||||
import dev.inmo.tgbotapi.types.message.RawMessageEntity
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.TelegramBotAPIMessageDeserializationStrategyClass
|
||||
import dev.inmo.tgbotapi.types.message.content.VideoContent
|
||||
import dev.inmo.tgbotapi.types.message.toRawMessageEntities
|
||||
import dev.inmo.tgbotapi.utils.extensions.makeString
|
||||
import dev.inmo.tgbotapi.utils.mapOfNotNull
|
||||
import dev.inmo.tgbotapi.utils.throwRangeError
|
||||
|
@ -4,14 +4,16 @@ import dev.inmo.tgbotapi.requests.abstracts.*
|
||||
import dev.inmo.tgbotapi.requests.send.abstracts.*
|
||||
import dev.inmo.tgbotapi.requests.send.media.base.*
|
||||
import dev.inmo.tgbotapi.types.*
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.*
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSourcesList
|
||||
import dev.inmo.tgbotapi.types.message.textsources.TextSourcesList
|
||||
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
||||
import dev.inmo.tgbotapi.types.ParseMode.parseModeField
|
||||
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
|
||||
import dev.inmo.tgbotapi.types.message.*
|
||||
import dev.inmo.tgbotapi.types.message.RawMessageEntity
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.TelegramBotAPIMessageDeserializationStrategyClass
|
||||
import dev.inmo.tgbotapi.types.message.content.VoiceContent
|
||||
import dev.inmo.tgbotapi.types.message.toRawMessageEntities
|
||||
import dev.inmo.tgbotapi.utils.extensions.makeString
|
||||
import dev.inmo.tgbotapi.utils.mapOfNotNull
|
||||
import dev.inmo.tgbotapi.utils.throwRangeError
|
||||
|
@ -5,13 +5,15 @@ import dev.inmo.tgbotapi.CommonAbstracts.TextedOutput
|
||||
import dev.inmo.tgbotapi.requests.send.abstracts.ReplyingMarkupSendMessageRequest
|
||||
import dev.inmo.tgbotapi.requests.send.abstracts.SendMessageRequest
|
||||
import dev.inmo.tgbotapi.types.*
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.*
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSource
|
||||
import dev.inmo.tgbotapi.types.message.textsources.TextSource
|
||||
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
||||
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
|
||||
import dev.inmo.tgbotapi.types.message.*
|
||||
import dev.inmo.tgbotapi.types.message.RawMessageEntity
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.TelegramBotAPIMessageDeserializationStrategyClass
|
||||
import dev.inmo.tgbotapi.types.message.content.PollContent
|
||||
import dev.inmo.tgbotapi.types.message.toRawMessageEntities
|
||||
import dev.inmo.tgbotapi.types.polls.*
|
||||
import dev.inmo.tgbotapi.utils.extensions.makeString
|
||||
import kotlinx.serialization.*
|
||||
|
@ -5,11 +5,13 @@ import dev.inmo.tgbotapi.types.*
|
||||
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.audio.InlineQueryResultAudioCached
|
||||
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.audio.inlineQueryResultAudioType
|
||||
import dev.inmo.tgbotapi.types.InlineQueries.InputMessageContent.InputMessageContent
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.*
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSourcesList
|
||||
import dev.inmo.tgbotapi.types.message.textsources.TextSourcesList
|
||||
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
||||
import dev.inmo.tgbotapi.types.ParseMode.parseModeField
|
||||
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
|
||||
import dev.inmo.tgbotapi.types.message.*
|
||||
import dev.inmo.tgbotapi.types.message.RawMessageEntity
|
||||
import dev.inmo.tgbotapi.types.message.toRawMessageEntities
|
||||
import dev.inmo.tgbotapi.utils.extensions.makeString
|
||||
import kotlinx.serialization.SerialName
|
||||
import kotlinx.serialization.Serializable
|
||||
|
@ -4,11 +4,13 @@ import dev.inmo.tgbotapi.types.*
|
||||
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.audio.InlineQueryResultAudio
|
||||
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.audio.inlineQueryResultAudioType
|
||||
import dev.inmo.tgbotapi.types.InlineQueries.InputMessageContent.InputMessageContent
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.*
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSourcesList
|
||||
import dev.inmo.tgbotapi.types.message.textsources.TextSourcesList
|
||||
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
||||
import dev.inmo.tgbotapi.types.ParseMode.parseModeField
|
||||
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
|
||||
import dev.inmo.tgbotapi.types.message.*
|
||||
import dev.inmo.tgbotapi.types.message.RawMessageEntity
|
||||
import dev.inmo.tgbotapi.types.message.toRawMessageEntities
|
||||
import dev.inmo.tgbotapi.utils.extensions.makeString
|
||||
import kotlinx.serialization.SerialName
|
||||
import kotlinx.serialization.Serializable
|
||||
|
@ -5,11 +5,13 @@ import dev.inmo.tgbotapi.types.*
|
||||
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.document.InlineQueryResultDocumentCached
|
||||
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.document.inlineQueryResultDocumentType
|
||||
import dev.inmo.tgbotapi.types.InlineQueries.InputMessageContent.InputMessageContent
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.*
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSourcesList
|
||||
import dev.inmo.tgbotapi.types.message.textsources.TextSourcesList
|
||||
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
||||
import dev.inmo.tgbotapi.types.ParseMode.parseModeField
|
||||
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
|
||||
import dev.inmo.tgbotapi.types.message.*
|
||||
import dev.inmo.tgbotapi.types.message.RawMessageEntity
|
||||
import dev.inmo.tgbotapi.types.message.toRawMessageEntities
|
||||
import dev.inmo.tgbotapi.utils.extensions.makeString
|
||||
import kotlinx.serialization.SerialName
|
||||
import kotlinx.serialization.Serializable
|
||||
|
@ -4,11 +4,13 @@ import dev.inmo.tgbotapi.types.*
|
||||
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.document.InlineQueryResultDocument
|
||||
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.document.inlineQueryResultDocumentType
|
||||
import dev.inmo.tgbotapi.types.InlineQueries.InputMessageContent.InputMessageContent
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.*
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSourcesList
|
||||
import dev.inmo.tgbotapi.types.message.textsources.TextSourcesList
|
||||
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
||||
import dev.inmo.tgbotapi.types.ParseMode.parseModeField
|
||||
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
|
||||
import dev.inmo.tgbotapi.types.message.*
|
||||
import dev.inmo.tgbotapi.types.message.RawMessageEntity
|
||||
import dev.inmo.tgbotapi.types.message.toRawMessageEntities
|
||||
import dev.inmo.tgbotapi.utils.MimeType
|
||||
import dev.inmo.tgbotapi.utils.extensions.makeString
|
||||
import kotlinx.serialization.SerialName
|
||||
|
@ -5,11 +5,13 @@ import dev.inmo.tgbotapi.types.*
|
||||
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.gif.InlineQueryResultGifCached
|
||||
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.gif.inlineQueryResultGifType
|
||||
import dev.inmo.tgbotapi.types.InlineQueries.InputMessageContent.InputMessageContent
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.*
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSourcesList
|
||||
import dev.inmo.tgbotapi.types.message.textsources.TextSourcesList
|
||||
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
||||
import dev.inmo.tgbotapi.types.ParseMode.parseModeField
|
||||
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
|
||||
import dev.inmo.tgbotapi.types.message.*
|
||||
import dev.inmo.tgbotapi.types.message.RawMessageEntity
|
||||
import dev.inmo.tgbotapi.types.message.toRawMessageEntities
|
||||
import dev.inmo.tgbotapi.utils.extensions.makeString
|
||||
import kotlinx.serialization.SerialName
|
||||
import kotlinx.serialization.Serializable
|
||||
|
@ -5,11 +5,13 @@ import dev.inmo.tgbotapi.types.*
|
||||
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.gif.InlineQueryResultGif
|
||||
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.gif.inlineQueryResultGifType
|
||||
import dev.inmo.tgbotapi.types.InlineQueries.InputMessageContent.InputMessageContent
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.*
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSourcesList
|
||||
import dev.inmo.tgbotapi.types.message.textsources.TextSourcesList
|
||||
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
||||
import dev.inmo.tgbotapi.types.ParseMode.parseModeField
|
||||
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
|
||||
import dev.inmo.tgbotapi.types.message.*
|
||||
import dev.inmo.tgbotapi.types.message.RawMessageEntity
|
||||
import dev.inmo.tgbotapi.types.message.toRawMessageEntities
|
||||
import dev.inmo.tgbotapi.utils.MimeType
|
||||
import dev.inmo.tgbotapi.utils.extensions.makeString
|
||||
import kotlinx.serialization.SerialName
|
||||
|
@ -5,11 +5,13 @@ import dev.inmo.tgbotapi.types.*
|
||||
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.mpeg4gif.InlineQueryResultMpeg4GifCached
|
||||
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.mpeg4gif.inlineQueryResultMpeg4GifType
|
||||
import dev.inmo.tgbotapi.types.InlineQueries.InputMessageContent.InputMessageContent
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.*
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSourcesList
|
||||
import dev.inmo.tgbotapi.types.message.textsources.TextSourcesList
|
||||
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
||||
import dev.inmo.tgbotapi.types.ParseMode.parseModeField
|
||||
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
|
||||
import dev.inmo.tgbotapi.types.message.*
|
||||
import dev.inmo.tgbotapi.types.message.RawMessageEntity
|
||||
import dev.inmo.tgbotapi.types.message.toRawMessageEntities
|
||||
import dev.inmo.tgbotapi.utils.extensions.makeString
|
||||
import kotlinx.serialization.SerialName
|
||||
import kotlinx.serialization.Serializable
|
||||
|
@ -4,11 +4,13 @@ import dev.inmo.tgbotapi.types.*
|
||||
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.mpeg4gif.InlineQueryResultMpeg4Gif
|
||||
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.mpeg4gif.inlineQueryResultMpeg4GifType
|
||||
import dev.inmo.tgbotapi.types.InlineQueries.InputMessageContent.InputMessageContent
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.*
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSourcesList
|
||||
import dev.inmo.tgbotapi.types.message.textsources.TextSourcesList
|
||||
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
||||
import dev.inmo.tgbotapi.types.ParseMode.parseModeField
|
||||
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
|
||||
import dev.inmo.tgbotapi.types.message.*
|
||||
import dev.inmo.tgbotapi.types.message.RawMessageEntity
|
||||
import dev.inmo.tgbotapi.types.message.toRawMessageEntities
|
||||
import dev.inmo.tgbotapi.utils.MimeType
|
||||
import dev.inmo.tgbotapi.utils.extensions.makeString
|
||||
import kotlinx.serialization.SerialName
|
||||
|
@ -5,11 +5,13 @@ import dev.inmo.tgbotapi.types.*
|
||||
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.photo.InlineQueryResultPhotoCached
|
||||
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.photo.inlineQueryResultPhotoType
|
||||
import dev.inmo.tgbotapi.types.InlineQueries.InputMessageContent.InputMessageContent
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.*
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSourcesList
|
||||
import dev.inmo.tgbotapi.types.message.textsources.TextSourcesList
|
||||
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
||||
import dev.inmo.tgbotapi.types.ParseMode.parseModeField
|
||||
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
|
||||
import dev.inmo.tgbotapi.types.message.*
|
||||
import dev.inmo.tgbotapi.types.message.RawMessageEntity
|
||||
import dev.inmo.tgbotapi.types.message.toRawMessageEntities
|
||||
import dev.inmo.tgbotapi.utils.extensions.makeString
|
||||
import kotlinx.serialization.SerialName
|
||||
import kotlinx.serialization.Serializable
|
||||
|
@ -4,11 +4,13 @@ import dev.inmo.tgbotapi.types.*
|
||||
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.photo.InlineQueryResultPhoto
|
||||
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.photo.inlineQueryResultPhotoType
|
||||
import dev.inmo.tgbotapi.types.InlineQueries.InputMessageContent.InputMessageContent
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.*
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSourcesList
|
||||
import dev.inmo.tgbotapi.types.message.textsources.TextSourcesList
|
||||
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
||||
import dev.inmo.tgbotapi.types.ParseMode.parseModeField
|
||||
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
|
||||
import dev.inmo.tgbotapi.types.message.*
|
||||
import dev.inmo.tgbotapi.types.message.RawMessageEntity
|
||||
import dev.inmo.tgbotapi.types.message.toRawMessageEntities
|
||||
import dev.inmo.tgbotapi.utils.extensions.makeString
|
||||
import kotlinx.serialization.SerialName
|
||||
import kotlinx.serialization.Serializable
|
||||
|
@ -5,11 +5,13 @@ import dev.inmo.tgbotapi.types.*
|
||||
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.video.InlineQueryResultVideoCached
|
||||
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.video.inlineQueryResultVideoType
|
||||
import dev.inmo.tgbotapi.types.InlineQueries.InputMessageContent.InputMessageContent
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.*
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSourcesList
|
||||
import dev.inmo.tgbotapi.types.message.textsources.TextSourcesList
|
||||
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
||||
import dev.inmo.tgbotapi.types.ParseMode.parseModeField
|
||||
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
|
||||
import dev.inmo.tgbotapi.types.message.*
|
||||
import dev.inmo.tgbotapi.types.message.RawMessageEntity
|
||||
import dev.inmo.tgbotapi.types.message.toRawMessageEntities
|
||||
import dev.inmo.tgbotapi.utils.extensions.makeString
|
||||
import kotlinx.serialization.SerialName
|
||||
import kotlinx.serialization.Serializable
|
||||
|
@ -4,11 +4,13 @@ import dev.inmo.tgbotapi.types.*
|
||||
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.video.InlineQueryResultVideo
|
||||
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.video.inlineQueryResultVideoType
|
||||
import dev.inmo.tgbotapi.types.InlineQueries.InputMessageContent.InputMessageContent
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.*
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSource
|
||||
import dev.inmo.tgbotapi.types.message.textsources.TextSource
|
||||
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
||||
import dev.inmo.tgbotapi.types.ParseMode.parseModeField
|
||||
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
|
||||
import dev.inmo.tgbotapi.types.message.*
|
||||
import dev.inmo.tgbotapi.types.message.RawMessageEntity
|
||||
import dev.inmo.tgbotapi.types.message.toRawMessageEntities
|
||||
import dev.inmo.tgbotapi.utils.MimeType
|
||||
import dev.inmo.tgbotapi.utils.extensions.makeString
|
||||
import kotlinx.serialization.SerialName
|
||||
|
@ -5,11 +5,13 @@ import dev.inmo.tgbotapi.types.*
|
||||
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.voice.InlineQueryResultVoiceCached
|
||||
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.voice.inlineQueryResultVoiceType
|
||||
import dev.inmo.tgbotapi.types.InlineQueries.InputMessageContent.InputMessageContent
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.*
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSourcesList
|
||||
import dev.inmo.tgbotapi.types.message.textsources.TextSourcesList
|
||||
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
||||
import dev.inmo.tgbotapi.types.ParseMode.parseModeField
|
||||
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
|
||||
import dev.inmo.tgbotapi.types.message.*
|
||||
import dev.inmo.tgbotapi.types.message.RawMessageEntity
|
||||
import dev.inmo.tgbotapi.types.message.toRawMessageEntities
|
||||
import dev.inmo.tgbotapi.utils.extensions.makeString
|
||||
import kotlinx.serialization.SerialName
|
||||
import kotlinx.serialization.Serializable
|
||||
|
@ -4,11 +4,13 @@ import dev.inmo.tgbotapi.types.*
|
||||
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.voice.InlineQueryResultVoice
|
||||
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.voice.inlineQueryResultVoiceType
|
||||
import dev.inmo.tgbotapi.types.InlineQueries.InputMessageContent.InputMessageContent
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.*
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSourcesList
|
||||
import dev.inmo.tgbotapi.types.message.textsources.TextSourcesList
|
||||
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
||||
import dev.inmo.tgbotapi.types.ParseMode.parseModeField
|
||||
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
|
||||
import dev.inmo.tgbotapi.types.message.*
|
||||
import dev.inmo.tgbotapi.types.message.RawMessageEntity
|
||||
import dev.inmo.tgbotapi.types.message.toRawMessageEntities
|
||||
import dev.inmo.tgbotapi.utils.extensions.makeString
|
||||
import kotlinx.serialization.SerialName
|
||||
import kotlinx.serialization.Serializable
|
||||
|
@ -3,10 +3,12 @@ package dev.inmo.tgbotapi.types.InlineQueries.InputMessageContent
|
||||
import dev.inmo.tgbotapi.CommonAbstracts.TextedOutput
|
||||
import dev.inmo.tgbotapi.CommonAbstracts.types.DisableWebPagePreview
|
||||
import dev.inmo.tgbotapi.types.*
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.*
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSourcesList
|
||||
import dev.inmo.tgbotapi.types.message.textsources.TextSourcesList
|
||||
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
||||
import dev.inmo.tgbotapi.types.ParseMode.parseModeField
|
||||
import dev.inmo.tgbotapi.types.message.*
|
||||
import dev.inmo.tgbotapi.types.message.RawMessageEntity
|
||||
import dev.inmo.tgbotapi.types.message.toRawMessageEntities
|
||||
import dev.inmo.tgbotapi.utils.extensions.makeString
|
||||
import kotlinx.serialization.SerialName
|
||||
import kotlinx.serialization.Serializable
|
||||
|
@ -1,8 +1,8 @@
|
||||
package dev.inmo.tgbotapi.types.InputMedia
|
||||
|
||||
import dev.inmo.tgbotapi.requests.abstracts.InputFile
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSourcesList
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.toRawMessageEntities
|
||||
import dev.inmo.tgbotapi.types.message.textsources.TextSourcesList
|
||||
import dev.inmo.tgbotapi.types.message.toRawMessageEntities
|
||||
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
||||
import dev.inmo.tgbotapi.types.media.TelegramMediaAnimation
|
||||
import dev.inmo.tgbotapi.utils.extensions.makeString
|
||||
|
@ -1,8 +1,8 @@
|
||||
package dev.inmo.tgbotapi.types.InputMedia
|
||||
|
||||
import dev.inmo.tgbotapi.requests.abstracts.InputFile
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSourcesList
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.toRawMessageEntities
|
||||
import dev.inmo.tgbotapi.types.message.textsources.TextSourcesList
|
||||
import dev.inmo.tgbotapi.types.message.toRawMessageEntities
|
||||
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
||||
import dev.inmo.tgbotapi.types.files.AudioFile
|
||||
import dev.inmo.tgbotapi.types.media.TelegramMediaAudio
|
||||
|
@ -1,8 +1,8 @@
|
||||
package dev.inmo.tgbotapi.types.InputMedia
|
||||
|
||||
import dev.inmo.tgbotapi.requests.abstracts.InputFile
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSourcesList
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.toRawMessageEntities
|
||||
import dev.inmo.tgbotapi.types.message.textsources.TextSourcesList
|
||||
import dev.inmo.tgbotapi.types.message.toRawMessageEntities
|
||||
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
||||
import dev.inmo.tgbotapi.types.files.DocumentFile
|
||||
import dev.inmo.tgbotapi.types.media.TelegramMediaDocument
|
||||
|
@ -1,8 +1,8 @@
|
||||
package dev.inmo.tgbotapi.types.InputMedia
|
||||
|
||||
import dev.inmo.tgbotapi.requests.abstracts.InputFile
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSourcesList
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.toRawMessageEntities
|
||||
import dev.inmo.tgbotapi.types.message.textsources.TextSourcesList
|
||||
import dev.inmo.tgbotapi.types.message.toRawMessageEntities
|
||||
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
||||
import dev.inmo.tgbotapi.types.files.PhotoSize
|
||||
import dev.inmo.tgbotapi.types.media.TelegramMediaPhoto
|
||||
|
@ -1,8 +1,8 @@
|
||||
package dev.inmo.tgbotapi.types.InputMedia
|
||||
|
||||
import dev.inmo.tgbotapi.requests.abstracts.InputFile
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSourcesList
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.toRawMessageEntities
|
||||
import dev.inmo.tgbotapi.types.message.textsources.TextSourcesList
|
||||
import dev.inmo.tgbotapi.types.message.toRawMessageEntities
|
||||
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
||||
import dev.inmo.tgbotapi.types.media.TelegramMediaVideo
|
||||
import dev.inmo.tgbotapi.utils.extensions.makeString
|
||||
|
@ -0,0 +1,8 @@
|
||||
package dev.inmo.tgbotapi.types.MessageEntity
|
||||
|
||||
@Deprecated("Redundant and will be removed soon")
|
||||
fun String.removeLeading(word: String) = if (startsWith(word)) {
|
||||
substring(word.length)
|
||||
} else {
|
||||
this
|
||||
}
|
@ -1,26 +1,17 @@
|
||||
package dev.inmo.tgbotapi.types.MessageEntity.textsources
|
||||
|
||||
import dev.inmo.tgbotapi.utils.RiskFeature
|
||||
import dev.inmo.tgbotapi.utils.extensions.makeString
|
||||
import dev.inmo.tgbotapi.utils.internal.*
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
/**
|
||||
* @see bold
|
||||
*/
|
||||
@Serializable
|
||||
data class BoldTextSource @RiskFeature(DirectInvocationOfTextSourceConstructor) constructor (
|
||||
override val source: String,
|
||||
override val subsources: TextSourcesList
|
||||
) : MultilevelTextSource {
|
||||
override val markdown: String by lazy { source.boldMarkdown() }
|
||||
override val markdownV2: String by lazy { boldMarkdownV2() }
|
||||
override val html: String by lazy { boldHTML() }
|
||||
}
|
||||
@Deprecated("Replaced", ReplaceWith("BoldTextSource", "dev.inmo.tgbotapi.types.message.textsources.BoldTextSource"))
|
||||
typealias BoldTextSource = dev.inmo.tgbotapi.types.message.textsources.BoldTextSource
|
||||
|
||||
@Suppress("NOTHING_TO_INLINE")
|
||||
inline fun bold(parts: TextSourcesList) = BoldTextSource(parts.makeString(), parts)
|
||||
@Deprecated("Replaced", ReplaceWith("bold", "dev.inmo.tgbotapi.types.message.textsources.bold"))
|
||||
inline fun bold(parts: TextSourcesList) = dev.inmo.tgbotapi.types.message.textsources.bold(parts)
|
||||
@Suppress("NOTHING_TO_INLINE")
|
||||
inline fun bold(vararg parts: TextSource) = bold(parts.toList())
|
||||
@Deprecated("Replaced", ReplaceWith("bold", "dev.inmo.tgbotapi.types.message.textsources.bold"))
|
||||
inline fun bold(vararg parts: TextSource) = dev.inmo.tgbotapi.types.message.textsources.bold(*parts)
|
||||
@Suppress("NOTHING_TO_INLINE")
|
||||
inline fun bold(text: String) = bold(regular(text))
|
||||
@Deprecated("Replaced", ReplaceWith("bold", "dev.inmo.tgbotapi.types.message.textsources.bold"))
|
||||
inline fun bold(text: String) = dev.inmo.tgbotapi.types.message.textsources.bold(text)
|
||||
|
@ -1,29 +1,16 @@
|
||||
package dev.inmo.tgbotapi.types.MessageEntity.textsources
|
||||
|
||||
import dev.inmo.tgbotapi.utils.RiskFeature
|
||||
import dev.inmo.tgbotapi.utils.internal.*
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
private val commandRegex = Regex("[/!][^@\\s]*")
|
||||
|
||||
/**
|
||||
* @see botCommand
|
||||
*/
|
||||
@Serializable
|
||||
data class BotCommandTextSource @RiskFeature(DirectInvocationOfTextSourceConstructor) constructor (
|
||||
override val source: String
|
||||
) : TextSource {
|
||||
val command: String by lazy {
|
||||
commandRegex.find(source) ?.value ?.substring(1) ?: source.substring(1)// skip first symbol like "/" or "!"
|
||||
}
|
||||
|
||||
override val markdown: String by lazy { source.commandMarkdown() }
|
||||
override val markdownV2: String by lazy { source.commandMarkdownV2() }
|
||||
override val html: String by lazy { source.commandHTML() }
|
||||
}
|
||||
@Deprecated("Replaced", ReplaceWith("BotCommandTextSource", "dev.inmo.tgbotapi.types.message.textsources.BotCommandTextSource"))
|
||||
typealias BotCommandTextSource = dev.inmo.tgbotapi.types.message.textsources.BotCommandTextSource
|
||||
|
||||
/**
|
||||
* @param command Without leading "/"
|
||||
*/
|
||||
@Suppress("NOTHING_TO_INLINE")
|
||||
inline fun botCommand(command: String) = BotCommandTextSource("/$command")
|
||||
@Deprecated("Replaced", ReplaceWith("botCommand", "dev.inmo.tgbotapi.types.message.textsources.botCommand"))
|
||||
inline fun botCommand(command: String) = dev.inmo.tgbotapi.types.message.textsources.botCommand(command)
|
||||
|
@ -1,26 +1,17 @@
|
||||
package dev.inmo.tgbotapi.types.MessageEntity.textsources
|
||||
|
||||
import dev.inmo.tgbotapi.utils.RiskFeature
|
||||
import dev.inmo.tgbotapi.utils.extensions.makeString
|
||||
import dev.inmo.tgbotapi.utils.internal.*
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
/**
|
||||
* @see cashTag
|
||||
*/
|
||||
@Serializable
|
||||
data class CashTagTextSource @RiskFeature(DirectInvocationOfTextSourceConstructor) constructor (
|
||||
override val source: String,
|
||||
override val subsources: TextSourcesList
|
||||
) : MultilevelTextSource {
|
||||
override val markdown: String by lazy { source.cashTagMarkdown() }
|
||||
override val markdownV2: String by lazy { cashTagMarkdownV2() }
|
||||
override val html: String by lazy { cashTagHTML() }
|
||||
}
|
||||
@Deprecated("Replaced", ReplaceWith("CashTagTextSource", "dev.inmo.tgbotapi.types.message.textsources.CashTagTextSource"))
|
||||
typealias CashTagTextSource = dev.inmo.tgbotapi.types.message.textsources.CashTagTextSource
|
||||
|
||||
@Suppress("NOTHING_TO_INLINE")
|
||||
inline fun cashTag(parts: TextSourcesList) = CashTagTextSource(parts.makeString(), parts)
|
||||
@Deprecated("Replaced", ReplaceWith("cashTag", "dev.inmo.tgbotapi.types.message.textsources.cashTag"))
|
||||
inline fun cashTag(parts: TextSourcesList) = dev.inmo.tgbotapi.types.message.textsources.cashTag(parts)
|
||||
@Suppress("NOTHING_TO_INLINE")
|
||||
inline fun cashTag(vararg parts: TextSource) = cashTag(parts.toList())
|
||||
@Deprecated("Replaced", ReplaceWith("cashTag", "dev.inmo.tgbotapi.types.message.textsources.cashTag"))
|
||||
inline fun cashTag(vararg parts: TextSource) = dev.inmo.tgbotapi.types.message.textsources.cashTag(*parts)
|
||||
@Suppress("NOTHING_TO_INLINE")
|
||||
inline fun cashTag(tag: String) = cashTag(regular(tag))
|
||||
@Deprecated("Replaced", ReplaceWith("cashTag", "dev.inmo.tgbotapi.types.message.textsources.cashTag"))
|
||||
inline fun cashTag(tag: String) = dev.inmo.tgbotapi.types.message.textsources.cashTag(tag)
|
||||
|
@ -1,20 +1,13 @@
|
||||
package dev.inmo.tgbotapi.types.MessageEntity.textsources
|
||||
|
||||
import dev.inmo.tgbotapi.utils.RiskFeature
|
||||
import dev.inmo.tgbotapi.utils.internal.*
|
||||
import kotlinx.serialization.Serializable
|
||||
import dev.inmo.tgbotapi.utils.internal.code
|
||||
|
||||
/**
|
||||
* @see code
|
||||
*/
|
||||
@Serializable
|
||||
data class CodeTextSource @RiskFeature(DirectInvocationOfTextSourceConstructor) constructor (
|
||||
override val source: String
|
||||
) : TextSource {
|
||||
override val markdown: String by lazy { source.codeMarkdown() }
|
||||
override val markdownV2: String by lazy { source.codeMarkdownV2() }
|
||||
override val html: String by lazy { source.codeHTML() }
|
||||
}
|
||||
@Deprecated("Replaced", ReplaceWith("CodeTextSource", "dev.inmo.tgbotapi.types.message.textsources.CodeTextSource"))
|
||||
typealias CodeTextSource = dev.inmo.tgbotapi.types.message.textsources.CodeTextSource
|
||||
|
||||
@Suppress("NOTHING_TO_INLINE")
|
||||
inline fun code(code: String) = CodeTextSource(code)
|
||||
@Deprecated("Replaced", ReplaceWith("code", "dev.inmo.tgbotapi.types.message.textsources.code"))
|
||||
inline fun code(code: String) = dev.inmo.tgbotapi.types.message.textsources.code(code)
|
||||
|
@ -1,26 +1,17 @@
|
||||
package dev.inmo.tgbotapi.types.MessageEntity.textsources
|
||||
|
||||
import dev.inmo.tgbotapi.utils.RiskFeature
|
||||
import dev.inmo.tgbotapi.utils.extensions.makeString
|
||||
import dev.inmo.tgbotapi.utils.internal.*
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
/**
|
||||
* @see email
|
||||
*/
|
||||
@Serializable
|
||||
data class EMailTextSource @RiskFeature(DirectInvocationOfTextSourceConstructor) constructor (
|
||||
override val source: String,
|
||||
override val subsources: TextSourcesList
|
||||
) : MultilevelTextSource {
|
||||
override val markdown: String by lazy { source.emailMarkdown() }
|
||||
override val markdownV2: String by lazy { emailMarkdownV2(source) }
|
||||
override val html: String by lazy { emailHTML(source) }
|
||||
}
|
||||
@Deprecated("Replaced", ReplaceWith("EMailTextSource", "dev.inmo.tgbotapi.types.message.textsources.EMailTextSource"))
|
||||
typealias EMailTextSource = dev.inmo.tgbotapi.types.message.textsources.EMailTextSource
|
||||
|
||||
@Suppress("NOTHING_TO_INLINE")
|
||||
inline fun email(parts: TextSourcesList) = EMailTextSource(parts.makeString(), parts)
|
||||
@Deprecated("Replaced", ReplaceWith("email", "dev.inmo.tgbotapi.types.message.textsources.email"))
|
||||
inline fun email(parts: TextSourcesList) = dev.inmo.tgbotapi.types.message.textsources.email(parts)
|
||||
@Suppress("NOTHING_TO_INLINE")
|
||||
inline fun email(vararg parts: TextSource) = email(parts.toList())
|
||||
@Deprecated("Replaced", ReplaceWith("email", "dev.inmo.tgbotapi.types.message.textsources.email"))
|
||||
inline fun email(vararg parts: TextSource) = dev.inmo.tgbotapi.types.message.textsources.email(*parts)
|
||||
@Suppress("NOTHING_TO_INLINE")
|
||||
inline fun email(emailAddress: String) = email(regular(emailAddress))
|
||||
@Deprecated("Replaced", ReplaceWith("email", "dev.inmo.tgbotapi.types.message.textsources.email"))
|
||||
inline fun email(emailAddress: String) = dev.inmo.tgbotapi.types.message.textsources.email(emailAddress)
|
||||
|
@ -1,35 +1,20 @@
|
||||
package dev.inmo.tgbotapi.types.MessageEntity.textsources
|
||||
|
||||
import dev.inmo.tgbotapi.utils.RiskFeature
|
||||
import dev.inmo.tgbotapi.utils.extensions.makeString
|
||||
import dev.inmo.tgbotapi.utils.internal.*
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
/**
|
||||
* @see hashtag
|
||||
*/
|
||||
@Serializable
|
||||
data class HashTagTextSource @RiskFeature(DirectInvocationOfTextSourceConstructor) constructor (
|
||||
override val source: String,
|
||||
override val subsources: TextSourcesList
|
||||
) : MultilevelTextSource {
|
||||
override val markdown: String by lazy { source.hashTagMarkdown() }
|
||||
override val markdownV2: String by lazy { hashTagMarkdownV2() }
|
||||
override val html: String by lazy { hashTagHTML() }
|
||||
|
||||
init {
|
||||
if (!source.startsWith("#")) {
|
||||
error("HashTag source must starts with #, but actual value is \"$source\"")
|
||||
}
|
||||
}
|
||||
}
|
||||
@Deprecated("Replaced", ReplaceWith("HashTagTextSource", "dev.inmo.tgbotapi.types.message.textsources.HashTagTextSource"))
|
||||
typealias HashTagTextSource = dev.inmo.tgbotapi.types.message.textsources.HashTagTextSource
|
||||
|
||||
@Suppress("NOTHING_TO_INLINE", "EXPERIMENTAL_API_USAGE")
|
||||
inline fun hashtag(parts: TextSourcesList) = (regular("#") + parts).let { HashTagTextSource(it.makeString(), it) }
|
||||
@Deprecated("Replaced", ReplaceWith("hashtag", "dev.inmo.tgbotapi.types.message.textsources.hashtag"))
|
||||
inline fun hashtag(parts: TextSourcesList) = dev.inmo.tgbotapi.types.message.textsources.hashtag(parts)
|
||||
@Suppress("NOTHING_TO_INLINE")
|
||||
inline fun hashtag(vararg parts: TextSource) = hashtag(parts.toList())
|
||||
@Deprecated("Replaced", ReplaceWith("hashtag", "dev.inmo.tgbotapi.types.message.textsources.hashtag"))
|
||||
inline fun hashtag(vararg parts: TextSource) = dev.inmo.tgbotapi.types.message.textsources.hashtag(*parts)
|
||||
/**
|
||||
* Without sharp (#)
|
||||
*/
|
||||
@Suppress("NOTHING_TO_INLINE")
|
||||
inline fun hashtag(hashtag: String) = hashtag(regular(hashtag))
|
||||
@Deprecated("Replaced", ReplaceWith("hashtag", "dev.inmo.tgbotapi.types.message.textsources.hashtag"))
|
||||
inline fun hashtag(hashtag: String) = dev.inmo.tgbotapi.types.message.textsources.hashtag(hashtag)
|
||||
|
@ -1,27 +1,18 @@
|
||||
package dev.inmo.tgbotapi.types.MessageEntity.textsources
|
||||
|
||||
import dev.inmo.tgbotapi.utils.RiskFeature
|
||||
import dev.inmo.tgbotapi.utils.extensions.makeString
|
||||
import dev.inmo.tgbotapi.utils.internal.*
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
/**
|
||||
* @see italic
|
||||
*/
|
||||
@Serializable
|
||||
data class ItalicTextSource @RiskFeature(DirectInvocationOfTextSourceConstructor) constructor (
|
||||
override val source: String,
|
||||
override val subsources: TextSourcesList
|
||||
) : MultilevelTextSource {
|
||||
override val markdown: String by lazy { source.italicMarkdown() }
|
||||
override val markdownV2: String by lazy { italicMarkdownV2() }
|
||||
override val html: String by lazy { italicHTML() }
|
||||
}
|
||||
@Deprecated("Replaced", ReplaceWith("ItalicTextSource", "dev.inmo.tgbotapi.types.message.textsources.ItalicTextSource"))
|
||||
typealias ItalicTextSource = dev.inmo.tgbotapi.types.message.textsources.ItalicTextSource
|
||||
|
||||
@Suppress("NOTHING_TO_INLINE")
|
||||
inline fun italic(parts: TextSourcesList) = ItalicTextSource(parts.makeString(), parts)
|
||||
@Deprecated("Replaced", ReplaceWith("italic", "dev.inmo.tgbotapi.types.message.textsources.italic"))
|
||||
inline fun italic(parts: TextSourcesList) = dev.inmo.tgbotapi.types.message.textsources.italic(parts)
|
||||
@Suppress("NOTHING_TO_INLINE")
|
||||
inline fun italic(vararg parts: TextSource) = italic(parts.toList())
|
||||
@Deprecated("Replaced", ReplaceWith("italic", "dev.inmo.tgbotapi.types.message.textsources.italic"))
|
||||
inline fun italic(vararg parts: TextSource) = dev.inmo.tgbotapi.types.message.textsources.italic(*parts)
|
||||
@Suppress("NOTHING_TO_INLINE")
|
||||
inline fun italic(text: String) = italic(regular(text))
|
||||
@Deprecated("Replaced", ReplaceWith("italic", "dev.inmo.tgbotapi.types.message.textsources.italic"))
|
||||
inline fun italic(text: String) = dev.inmo.tgbotapi.types.message.textsources.italic(text)
|
||||
|
||||
|
@ -1,49 +1,28 @@
|
||||
package dev.inmo.tgbotapi.types.MessageEntity.textsources
|
||||
|
||||
import dev.inmo.tgbotapi.types.Username
|
||||
import dev.inmo.tgbotapi.utils.RiskFeature
|
||||
import dev.inmo.tgbotapi.utils.extensions.makeString
|
||||
import dev.inmo.tgbotapi.utils.internal.*
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
private val String.withoutCommercialAt
|
||||
get() = if (startsWith("@")) {
|
||||
substring(1)
|
||||
} else {
|
||||
this
|
||||
}
|
||||
|
||||
/**
|
||||
* @see mention
|
||||
*/
|
||||
@Serializable
|
||||
data class MentionTextSource @RiskFeature(DirectInvocationOfTextSourceConstructor) constructor (
|
||||
override val source: String,
|
||||
override val subsources: TextSourcesList
|
||||
) : MultilevelTextSource {
|
||||
override val markdown: String by lazy { source.mentionMarkdown() }
|
||||
override val markdownV2: String by lazy { mentionMarkdownV2() }
|
||||
override val html: String by lazy { mentionHTML() }
|
||||
val username: Username = Username(source)
|
||||
|
||||
init {
|
||||
if (!source.startsWith("@")) {
|
||||
error("Mention source must starts with @, but actual value is \"$source\"")
|
||||
}
|
||||
}
|
||||
}
|
||||
@Deprecated("Replaced", ReplaceWith("MentionTextSource", "dev.inmo.tgbotapi.types.message.textsources.MentionTextSource"))
|
||||
typealias MentionTextSource = dev.inmo.tgbotapi.types.message.textsources.MentionTextSource
|
||||
|
||||
@Suppress("NOTHING_TO_INLINE")
|
||||
inline fun mention(parts: TextSourcesList) = (regular("@") + parts).let { MentionTextSource(it.makeString(), it) }
|
||||
@Deprecated("Replaced", ReplaceWith("mention", "dev.inmo.tgbotapi.types.message.textsources.mention"))
|
||||
inline fun mention(parts: TextSourcesList) = dev.inmo.tgbotapi.types.message.textsources.mention(parts)
|
||||
@Suppress("NOTHING_TO_INLINE")
|
||||
inline fun mention(vararg parts: TextSource) = mention(parts.toList())
|
||||
@Deprecated("Replaced", ReplaceWith("mention", "dev.inmo.tgbotapi.types.message.textsources.mention"))
|
||||
inline fun mention(vararg parts: TextSource) = dev.inmo.tgbotapi.types.message.textsources.mention(*parts)
|
||||
|
||||
/**
|
||||
* Without leading "@"
|
||||
*/
|
||||
@Suppress("NOTHING_TO_INLINE")
|
||||
inline fun mention(whoToMention: String) = mention(regular(whoToMention))
|
||||
@Deprecated("Replaced", ReplaceWith("mention", "dev.inmo.tgbotapi.types.message.textsources.mention"))
|
||||
inline fun mention(whoToMention: String) = dev.inmo.tgbotapi.types.message.textsources.mention(whoToMention)
|
||||
|
||||
@Suppress("NOTHING_TO_INLINE")
|
||||
inline fun mention(whoToMention: Username) = mention(whoToMention.username.dropWhile { it == '@' })
|
||||
@Deprecated("Replaced", ReplaceWith("mention", "dev.inmo.tgbotapi.types.message.textsources.mention"))
|
||||
inline fun mention(whoToMention: Username) = dev.inmo.tgbotapi.types.message.textsources.mention(whoToMention)
|
||||
|
||||
|
@ -1,27 +1,18 @@
|
||||
package dev.inmo.tgbotapi.types.MessageEntity.textsources
|
||||
|
||||
import dev.inmo.tgbotapi.utils.RiskFeature
|
||||
import dev.inmo.tgbotapi.utils.extensions.makeString
|
||||
import dev.inmo.tgbotapi.utils.internal.*
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
/**
|
||||
* @see phone
|
||||
*/
|
||||
@Serializable
|
||||
data class PhoneNumberTextSource @RiskFeature(DirectInvocationOfTextSourceConstructor) constructor (
|
||||
override val source: String,
|
||||
override val subsources: TextSourcesList
|
||||
) : MultilevelTextSource {
|
||||
override val markdown: String by lazy { source.phoneMarkdown() }
|
||||
override val markdownV2: String by lazy { phoneMarkdownV2() }
|
||||
override val html: String by lazy { phoneHTML() }
|
||||
}
|
||||
@Deprecated("Replaced", ReplaceWith("PhoneNumberTextSource", "dev.inmo.tgbotapi.types.message.textsources.PhoneNumberTextSource"))
|
||||
typealias PhoneNumberTextSource = dev.inmo.tgbotapi.types.message.textsources.PhoneNumberTextSource
|
||||
|
||||
@Suppress("NOTHING_TO_INLINE")
|
||||
inline fun phone(parts: TextSourcesList) = PhoneNumberTextSource(parts.makeString(), parts)
|
||||
@Deprecated("Replaced", ReplaceWith("phone", "dev.inmo.tgbotapi.types.message.textsources.phone"))
|
||||
inline fun phone(parts: TextSourcesList) = dev.inmo.tgbotapi.types.message.textsources.phone(parts)
|
||||
@Suppress("NOTHING_TO_INLINE")
|
||||
inline fun phone(vararg parts: TextSource) = phone(parts.toList())
|
||||
@Deprecated("Replaced", ReplaceWith("phone", "dev.inmo.tgbotapi.types.message.textsources.phone"))
|
||||
inline fun phone(vararg parts: TextSource) = dev.inmo.tgbotapi.types.message.textsources.phone(*parts)
|
||||
@Suppress("NOTHING_TO_INLINE")
|
||||
inline fun phone(number: String) = phone(regular(number))
|
||||
@Deprecated("Replaced", ReplaceWith("phone", "dev.inmo.tgbotapi.types.message.textsources.phone"))
|
||||
inline fun phone(number: String) = dev.inmo.tgbotapi.types.message.textsources.phone(number)
|
||||
|
||||
|
@ -1,22 +1,12 @@
|
||||
package dev.inmo.tgbotapi.types.MessageEntity.textsources
|
||||
|
||||
import dev.inmo.tgbotapi.utils.RiskFeature
|
||||
import dev.inmo.tgbotapi.utils.internal.*
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
/**
|
||||
* @see pre
|
||||
*/
|
||||
@Serializable
|
||||
data class PreTextSource @RiskFeature(DirectInvocationOfTextSourceConstructor) constructor (
|
||||
override val source: String,
|
||||
val language: String? = null
|
||||
) : TextSource {
|
||||
override val markdown: String by lazy { source.preMarkdown(language) }
|
||||
override val markdownV2: String by lazy { source.preMarkdownV2(language) }
|
||||
override val html: String by lazy { source.preHTML(language) }
|
||||
}
|
||||
@Deprecated("Replaced", ReplaceWith("PreTextSource", "dev.inmo.tgbotapi.types.message.textsources.PreTextSource"))
|
||||
typealias PreTextSource = dev.inmo.tgbotapi.types.message.textsources.PreTextSource
|
||||
|
||||
@Suppress("NOTHING_TO_INLINE")
|
||||
inline fun pre(code: String, language: String? = null) = PreTextSource(code, language)
|
||||
@Deprecated("Replaced", ReplaceWith("pre", "dev.inmo.tgbotapi.types.message.textsources.pre"))
|
||||
inline fun pre(code: String, language: String? = null) = dev.inmo.tgbotapi.types.message.textsources.pre(code, language)
|
||||
|
||||
|
@ -1,20 +1,11 @@
|
||||
package dev.inmo.tgbotapi.types.MessageEntity.textsources
|
||||
|
||||
import dev.inmo.tgbotapi.utils.RiskFeature
|
||||
import dev.inmo.tgbotapi.utils.internal.*
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
/**
|
||||
* @see regular
|
||||
*/
|
||||
@Serializable
|
||||
data class RegularTextSource @RiskFeature(DirectInvocationOfTextSourceConstructor) constructor (
|
||||
override val source: String
|
||||
) : TextSource {
|
||||
override val markdown: String by lazy { source.regularMarkdown() }
|
||||
override val markdownV2: String by lazy { source.regularMarkdownV2() }
|
||||
override val html: String by lazy { source.regularHtml() }
|
||||
}
|
||||
@Deprecated("Replaced", ReplaceWith("RegularTextSource", "dev.inmo.tgbotapi.types.message.textsources.RegularTextSource"))
|
||||
typealias RegularTextSource = dev.inmo.tgbotapi.types.message.textsources.RegularTextSource
|
||||
|
||||
@Suppress("NOTHING_TO_INLINE")
|
||||
inline fun regular(text: String) = RegularTextSource(text)
|
||||
@Deprecated("Replaced", ReplaceWith("regular", "dev.inmo.tgbotapi.types.message.textsources.regular"))
|
||||
inline fun regular(text: String) = dev.inmo.tgbotapi.types.message.textsources.regular(text)
|
||||
|
@ -1,27 +1,18 @@
|
||||
package dev.inmo.tgbotapi.types.MessageEntity.textsources
|
||||
|
||||
import dev.inmo.tgbotapi.utils.RiskFeature
|
||||
import dev.inmo.tgbotapi.utils.extensions.makeString
|
||||
import dev.inmo.tgbotapi.utils.internal.*
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
/**
|
||||
* @see italic
|
||||
*/
|
||||
@Serializable
|
||||
data class SpoilerTextSource @RiskFeature(DirectInvocationOfTextSourceConstructor) constructor (
|
||||
override val source: String,
|
||||
override val subsources: TextSourcesList
|
||||
) : MultilevelTextSource {
|
||||
override val markdown: String by lazy { source.spoilerMarkdown() }
|
||||
override val markdownV2: String by lazy { spoilerMarkdownV2() }
|
||||
override val html: String by lazy { spoilerHTML() }
|
||||
}
|
||||
@Deprecated("Replaced", ReplaceWith("SpoilerTextSource", "dev.inmo.tgbotapi.types.message.textsources.SpoilerTextSource"))
|
||||
typealias SpoilerTextSource = dev.inmo.tgbotapi.types.message.textsources.SpoilerTextSource
|
||||
|
||||
@Suppress("NOTHING_TO_INLINE")
|
||||
inline fun spoiler(parts: TextSourcesList) = SpoilerTextSource(parts.makeString(), parts)
|
||||
@Deprecated("Replaced", ReplaceWith("spoiler", "dev.inmo.tgbotapi.types.message.textsources.spoiler"))
|
||||
inline fun spoiler(parts: TextSourcesList) = dev.inmo.tgbotapi.types.message.textsources.spoiler(parts)
|
||||
@Suppress("NOTHING_TO_INLINE")
|
||||
inline fun spoiler(vararg parts: TextSource) = spoiler(parts.toList())
|
||||
@Deprecated("Replaced", ReplaceWith("spoiler", "dev.inmo.tgbotapi.types.message.textsources.spoiler"))
|
||||
inline fun spoiler(vararg parts: TextSource) = dev.inmo.tgbotapi.types.message.textsources.spoiler(*parts)
|
||||
@Suppress("NOTHING_TO_INLINE")
|
||||
inline fun spoiler(text: String) = spoiler(regular(text))
|
||||
@Deprecated("Replaced", ReplaceWith("spoiler", "dev.inmo.tgbotapi.types.message.textsources.spoiler"))
|
||||
inline fun spoiler(text: String) = dev.inmo.tgbotapi.types.message.textsources.spoiler(text)
|
||||
|
||||
|
@ -1,26 +1,17 @@
|
||||
package dev.inmo.tgbotapi.types.MessageEntity.textsources
|
||||
|
||||
import dev.inmo.tgbotapi.utils.RiskFeature
|
||||
import dev.inmo.tgbotapi.utils.extensions.makeString
|
||||
import dev.inmo.tgbotapi.utils.internal.*
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
/**
|
||||
* @see strikethrough
|
||||
*/
|
||||
@Serializable
|
||||
data class StrikethroughTextSource @RiskFeature(DirectInvocationOfTextSourceConstructor) constructor (
|
||||
override val source: String,
|
||||
override val subsources: TextSourcesList
|
||||
) : MultilevelTextSource {
|
||||
override val html: String by lazy { strikethroughHTML() }
|
||||
override val markdownV2: String by lazy { strikethroughMarkdownV2() }
|
||||
override val markdown: String by lazy { source.strikethroughMarkdown() }
|
||||
}
|
||||
@Deprecated("Replaced", ReplaceWith("StrikethroughTextSource", "dev.inmo.tgbotapi.types.message.textsources.StrikethroughTextSource"))
|
||||
typealias StrikethroughTextSource = dev.inmo.tgbotapi.types.message.textsources.StrikethroughTextSource
|
||||
|
||||
@Suppress("NOTHING_TO_INLINE")
|
||||
inline fun strikethrough(parts: TextSourcesList) = StrikethroughTextSource(parts.makeString(), parts)
|
||||
@Deprecated("Replaced", ReplaceWith("strikethrough", "dev.inmo.tgbotapi.types.message.textsources.strikethrough"))
|
||||
inline fun strikethrough(parts: TextSourcesList) = dev.inmo.tgbotapi.types.message.textsources.strikethrough(parts)
|
||||
@Suppress("NOTHING_TO_INLINE")
|
||||
inline fun strikethrough(vararg parts: TextSource) = strikethrough(parts.toList())
|
||||
@Deprecated("Replaced", ReplaceWith("strikethrough", "dev.inmo.tgbotapi.types.message.textsources.strikethrough"))
|
||||
inline fun strikethrough(vararg parts: TextSource) = dev.inmo.tgbotapi.types.message.textsources.strikethrough(*parts)
|
||||
@Suppress("NOTHING_TO_INLINE")
|
||||
inline fun strikethrough(text: String) = strikethrough(regular(text))
|
||||
@Deprecated("Replaced", ReplaceWith("strikethrough", "dev.inmo.tgbotapi.types.message.textsources.strikethrough"))
|
||||
inline fun strikethrough(text: String) = dev.inmo.tgbotapi.types.message.textsources.strikethrough(text)
|
||||
|
@ -1,21 +1,13 @@
|
||||
package dev.inmo.tgbotapi.types.MessageEntity.textsources
|
||||
|
||||
import dev.inmo.tgbotapi.utils.RiskFeature
|
||||
import dev.inmo.tgbotapi.utils.internal.*
|
||||
import kotlinx.serialization.Serializable
|
||||
import dev.inmo.tgbotapi.utils.internal.link
|
||||
|
||||
/**
|
||||
* @see link
|
||||
*/
|
||||
@Serializable
|
||||
data class TextLinkTextSource @RiskFeature(DirectInvocationOfTextSourceConstructor) constructor (
|
||||
override val source: String,
|
||||
val url: String
|
||||
) : TextSource {
|
||||
override val markdown: String by lazy { source.linkMarkdown(url) }
|
||||
override val markdownV2: String by lazy { source.linkMarkdownV2(url) }
|
||||
override val html: String by lazy { source.linkHTML(url) }
|
||||
}
|
||||
@Deprecated("Replaced", ReplaceWith("TextLinkTextSource", "dev.inmo.tgbotapi.types.message.textsources.TextLinkTextSource"))
|
||||
typealias TextLinkTextSource = dev.inmo.tgbotapi.types.message.textsources.TextLinkTextSource
|
||||
|
||||
@Suppress("NOTHING_TO_INLINE")
|
||||
inline fun link(text: String, url: String) = TextLinkTextSource(text, url)
|
||||
@Deprecated("Replaced", ReplaceWith("link", "dev.inmo.tgbotapi.types.message.textsources.link"))
|
||||
inline fun link(text: String, url: String) = dev.inmo.tgbotapi.types.message.textsources.link(text, url)
|
||||
|
@ -1,55 +1,51 @@
|
||||
package dev.inmo.tgbotapi.types.MessageEntity.textsources
|
||||
|
||||
import dev.inmo.tgbotapi.types.*
|
||||
import dev.inmo.tgbotapi.types.chat.CommonUser
|
||||
import dev.inmo.tgbotapi.types.Identifier
|
||||
import dev.inmo.tgbotapi.types.UserId
|
||||
import dev.inmo.tgbotapi.types.chat.User
|
||||
import dev.inmo.tgbotapi.utils.RiskFeature
|
||||
import dev.inmo.tgbotapi.utils.extensions.makeString
|
||||
import dev.inmo.tgbotapi.utils.internal.*
|
||||
import kotlinx.serialization.Serializable
|
||||
import dev.inmo.tgbotapi.types.message.textsources.mention
|
||||
|
||||
/**
|
||||
* @see mention
|
||||
*/
|
||||
@Serializable
|
||||
data class TextMentionTextSource @RiskFeature(DirectInvocationOfTextSourceConstructor) constructor (
|
||||
override val source: String,
|
||||
val user: User,
|
||||
override val subsources: TextSourcesList
|
||||
) : MultilevelTextSource {
|
||||
override val markdown: String by lazy { source.textMentionMarkdown(user.id) }
|
||||
override val markdownV2: String by lazy { textMentionMarkdownV2(user.id) }
|
||||
override val html: String by lazy { textMentionHTML(user.id) }
|
||||
}
|
||||
@Deprecated("Replaced", ReplaceWith("TextMentionTextSource", "dev.inmo.tgbotapi.types.message.textsources.TextMentionTextSource"))
|
||||
typealias TextMentionTextSource = dev.inmo.tgbotapi.types.message.textsources.TextMentionTextSource
|
||||
|
||||
@Suppress("NOTHING_TO_INLINE")
|
||||
inline fun mention(parts: TextSourcesList, user: User) = TextMentionTextSource(parts.makeString(), user, parts)
|
||||
@Deprecated("Replaced", ReplaceWith("mention", "dev.inmo.tgbotapi.types.message.textsources.mention"))
|
||||
inline fun mention(parts: TextSourcesList, user: User) = mention(parts, user)
|
||||
@Suppress("NOTHING_TO_INLINE")
|
||||
inline fun User.mention(parts: TextSourcesList) = mention(parts, this)
|
||||
@Deprecated("Replaced", ReplaceWith("User.mention", "dev.inmo.tgbotapi.types.message.textsources.User.mention"))
|
||||
inline fun User.mention(parts: TextSourcesList) = mention(parts)
|
||||
@Suppress("NOTHING_TO_INLINE")
|
||||
inline fun mention(parts: TextSourcesList, userId: UserId) = mention(parts, CommonUser(userId, ""))
|
||||
@Deprecated("Replaced", ReplaceWith("mention", "dev.inmo.tgbotapi.types.message.textsources.mention"))
|
||||
inline fun mention(parts: TextSourcesList, userId: UserId) = mention(parts, userId)
|
||||
@Suppress("NOTHING_TO_INLINE")
|
||||
inline fun UserId.mention(parts: TextSourcesList) = mention(parts, this)
|
||||
@Deprecated("Replaced", ReplaceWith("UserId.mention", "dev.inmo.tgbotapi.types.message.textsources.UserId.mention"))
|
||||
inline fun UserId.mention(parts: TextSourcesList) = mention(parts)
|
||||
@Suppress("NOTHING_TO_INLINE")
|
||||
inline fun mention(parts: TextSourcesList, id: Identifier) = mention(parts, UserId(id))
|
||||
@Deprecated("Replaced", ReplaceWith("mention", "dev.inmo.tgbotapi.types.message.textsources.mention"))
|
||||
inline fun mention(parts: TextSourcesList, id: Identifier) = mention(parts, id)
|
||||
@Suppress("NOTHING_TO_INLINE")
|
||||
inline fun Identifier.mention(parts: TextSourcesList) = mention(parts, this)
|
||||
@Deprecated("Replaced", ReplaceWith("Identifier.mention", "dev.inmo.tgbotapi.types.message.textsources.Identifier.mention"))
|
||||
inline fun Identifier.mention(parts: TextSourcesList) = mention(parts)
|
||||
@Suppress("NOTHING_TO_INLINE")
|
||||
inline fun mention(user: User, vararg parts: TextSource) = mention(
|
||||
textSourcesOrElseTextSource(parts.toList()) {
|
||||
RegularTextSource("${user.lastName} ${user.firstName}")
|
||||
},
|
||||
user
|
||||
)
|
||||
inline fun mention(user: User, vararg parts: TextSource) = mention(user, *parts)
|
||||
@Suppress("NOTHING_TO_INLINE")
|
||||
inline fun mention(text: String, user: User) = mention(user, regular(text))
|
||||
@Deprecated("Replaced", ReplaceWith("mention", "dev.inmo.tgbotapi.types.message.textsources.mention"))
|
||||
inline fun mention(text: String, user: User) = mention(text, user)
|
||||
@Suppress("NOTHING_TO_INLINE")
|
||||
inline fun User.mention(text: String) = mention(this, regular(text))
|
||||
@Deprecated("Replaced", ReplaceWith("User.mention", "dev.inmo.tgbotapi.types.message.textsources.User.mention"))
|
||||
inline fun User.mention(text: String) = mention(text)
|
||||
@Suppress("NOTHING_TO_INLINE")
|
||||
inline fun mention(text: String, userId: UserId) = mention(text, CommonUser(userId, ""))
|
||||
@Deprecated("Replaced", ReplaceWith("mention", "dev.inmo.tgbotapi.types.message.textsources.mention"))
|
||||
inline fun mention(text: String, userId: UserId) = mention(text, userId)
|
||||
@Suppress("NOTHING_TO_INLINE")
|
||||
inline fun UserId.mention(text: String) = mention(text, this)
|
||||
@Deprecated("Replaced", ReplaceWith("UserId.mention", "dev.inmo.tgbotapi.types.message.textsources.UserId.mention"))
|
||||
inline fun UserId.mention(text: String) = mention(text)
|
||||
@Suppress("NOTHING_TO_INLINE")
|
||||
inline fun mention(text: String, id: Identifier) = mention(text, UserId(id))
|
||||
@Deprecated("Replaced", ReplaceWith("mention", "dev.inmo.tgbotapi.types.message.textsources.mention"))
|
||||
inline fun mention(text: String, id: Identifier) = mention(text, id)
|
||||
@Suppress("NOTHING_TO_INLINE")
|
||||
inline fun Identifier.mention(text: String) = mention(text, this)
|
||||
@Deprecated("Replaced", ReplaceWith("Identifier.mention", "dev.inmo.tgbotapi.types.message.textsources.Identifier.mention"))
|
||||
inline fun Identifier.mention(text: String) = mention(text)
|
||||
|
@ -1,80 +1,50 @@
|
||||
package dev.inmo.tgbotapi.types.MessageEntity.textsources
|
||||
|
||||
import dev.inmo.tgbotapi.types.captionLength
|
||||
import dev.inmo.tgbotapi.types.message.textsources.separateForCaption
|
||||
import dev.inmo.tgbotapi.types.message.textsources.separateForMessage
|
||||
import dev.inmo.tgbotapi.types.message.textsources.separateForText
|
||||
import dev.inmo.tgbotapi.types.textLength
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
const val DirectInvocationOfTextSourceConstructor = "It is strongly not recommended to use constructors directly instead of factory methods"
|
||||
|
||||
typealias TextSourcesList = List<TextSource>
|
||||
typealias MutableTextSourcesList = MutableList<TextSource>
|
||||
@Deprecated("Replaced", ReplaceWith("TextSourcesList", "dev.inmo.tgbotapi.types.message.textsources.TextSourcesList"))
|
||||
typealias TextSourcesList = dev.inmo.tgbotapi.types.message.textsources.TextSourcesList
|
||||
@Deprecated("Replaced", ReplaceWith("MutableTextSourcesList", "dev.inmo.tgbotapi.types.message.textsources.MutableTextSourcesList"))
|
||||
typealias MutableTextSourcesList = dev.inmo.tgbotapi.types.message.textsources.MutableTextSourcesList
|
||||
|
||||
@Serializable(TextSourceSerializer::class)
|
||||
sealed interface TextSource {
|
||||
val markdown: String
|
||||
val markdownV2: String
|
||||
val html: String
|
||||
val source: String
|
||||
|
||||
val asText: String
|
||||
get() = source
|
||||
}
|
||||
@Deprecated("Replaced", ReplaceWith("TextSource", "dev.inmo.tgbotapi.types.message.textsources.TextSource"))
|
||||
typealias TextSource = dev.inmo.tgbotapi.types.message.textsources.TextSource
|
||||
|
||||
@Suppress("NOTHING_TO_INLINE")
|
||||
@Deprecated("Replaced", ReplaceWith("plus", "dev.inmo.tgbotapi.types.message.textsources.plus"))
|
||||
inline operator fun TextSource.plus(other: TextSource) = listOf(this, other)
|
||||
@Suppress("NOTHING_TO_INLINE")
|
||||
@Deprecated("Replaced", ReplaceWith("plus", "dev.inmo.tgbotapi.types.message.textsources.plus"))
|
||||
inline operator fun TextSource.plus(other: List<TextSource>) = listOf(this) + other
|
||||
@Suppress("NOTHING_TO_INLINE")
|
||||
@Deprecated("Replaced", ReplaceWith("plus", "dev.inmo.tgbotapi.types.message.textsources.plus"))
|
||||
inline operator fun TextSource.plus(text: String) = listOf(this, regular(text))
|
||||
@Suppress("NOTHING_TO_INLINE")
|
||||
@Deprecated("Replaced", ReplaceWith("plus", "dev.inmo.tgbotapi.types.message.textsources.plus"))
|
||||
inline operator fun List<TextSource>.plus(text: String) = this + regular(text)
|
||||
|
||||
@Serializable(TextSourceSerializer::class)
|
||||
sealed interface MultilevelTextSource : TextSource {
|
||||
val subsources: List<TextSource>
|
||||
}
|
||||
@Deprecated("Replaced", ReplaceWith("MultilevelTextSource", "dev.inmo.tgbotapi.types.message.textsources.MultilevelTextSource"))
|
||||
typealias MultilevelTextSource = dev.inmo.tgbotapi.types.message.textsources.MultilevelTextSource
|
||||
|
||||
fun List<TextSource>.separateForMessage(limit: IntRange, numberOfParts: Int? = null): List<List<TextSource>> {
|
||||
if (isEmpty()) {
|
||||
return emptyList()
|
||||
}
|
||||
|
||||
val resultList = mutableListOf<MutableList<TextSource>>(mutableListOf())
|
||||
var currentPartLength = 0
|
||||
val maxSize = limit.last + 1
|
||||
|
||||
for (current in this) {
|
||||
if (current.source.length > maxSize) {
|
||||
error("Currently unsupported parts with size more than target one-message parts (${current.source.length} > ${maxSize})")
|
||||
}
|
||||
|
||||
if (currentPartLength + current.source.length > maxSize) {
|
||||
if (numberOfParts == null || numberOfParts < resultList.size) {
|
||||
resultList.add(mutableListOf())
|
||||
currentPartLength = 0
|
||||
} else {
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
resultList.last().add(current)
|
||||
currentPartLength += current.source.length
|
||||
}
|
||||
|
||||
return resultList
|
||||
}
|
||||
@Deprecated("Replaced", ReplaceWith("separateForMessage", "dev.inmo.tgbotapi.types.message.textsources.separateForMessage"))
|
||||
inline fun List<TextSource>.separateForMessage(limit: IntRange, numberOfParts: Int? = null) = separateForMessage(limit, numberOfParts)
|
||||
|
||||
/**
|
||||
* This method will prepare [TextSource]s list for messages. Remember, that first part will be separated with
|
||||
* [captionLength] and all others with
|
||||
*/
|
||||
fun List<TextSource>.separateForCaption(): List<List<TextSource>> {
|
||||
val captionPart = separateForMessage(captionLength, 1).first()
|
||||
return listOf(captionPart) + minus(captionPart).separateForMessage(textLength)
|
||||
}
|
||||
@Deprecated("Replaced", ReplaceWith("separateForCaption", "dev.inmo.tgbotapi.types.message.textsources.separateForCaption"))
|
||||
fun List<TextSource>.separateForCaption() = separateForCaption()
|
||||
|
||||
/**
|
||||
* This method will prepare [TextSource]s list for messages with [textLength]
|
||||
*/
|
||||
@Suppress("NOTHING_TO_INLINE")
|
||||
inline fun List<TextSource>.separateForText(): List<List<TextSource>> = separateForMessage(textLength)
|
||||
@Deprecated("Replaced", ReplaceWith("separateForText", "dev.inmo.tgbotapi.types.message.textsources.separateForText"))
|
||||
inline fun List<TextSource>.separateForText() = separateForText()
|
||||
|
@ -1,36 +1,5 @@
|
||||
package dev.inmo.tgbotapi.types.MessageEntity.textsources
|
||||
|
||||
import dev.inmo.micro_utils.serialization.typed_serializer.TypedSerializer
|
||||
import kotlinx.serialization.KSerializer
|
||||
import dev.inmo.tgbotapi.types.message.textsources.TextSourceSerializer
|
||||
|
||||
private val baseSerializers: Map<String, KSerializer<out TextSource>> = mapOf(
|
||||
"regular" to RegularTextSource.serializer(),
|
||||
"text_link" to TextLinkTextSource.serializer(),
|
||||
"code" to CodeTextSource.serializer(),
|
||||
"url" to URLTextSource.serializer(),
|
||||
"pre" to PreTextSource.serializer(),
|
||||
"bot_command" to BotCommandTextSource.serializer(),
|
||||
"strikethrough" to StrikethroughTextSource.serializer(),
|
||||
"italic" to ItalicTextSource.serializer(),
|
||||
"bold" to BoldTextSource.serializer(),
|
||||
"email" to EMailTextSource.serializer(),
|
||||
"underline" to UnderlineTextSource.serializer(),
|
||||
"mention" to MentionTextSource.serializer(),
|
||||
"phone_number" to PhoneNumberTextSource.serializer(),
|
||||
"text_mention" to TextMentionTextSource.serializer(),
|
||||
"hashtag" to HashTagTextSource.serializer(),
|
||||
"cashtag" to CashTagTextSource.serializer(),
|
||||
"spoiler" to SpoilerTextSource.serializer(),
|
||||
)
|
||||
|
||||
object TextSourceSerializer : TypedSerializer<TextSource>(TextSource::class, baseSerializers) {
|
||||
override fun <T: TextSource> include(type: String, serializer: KSerializer<T>) {
|
||||
require(type !in baseSerializers.keys)
|
||||
super.include(type, serializer)
|
||||
}
|
||||
|
||||
override fun exclude(type: String) {
|
||||
require(type !in baseSerializers.keys)
|
||||
super.exclude(type)
|
||||
}
|
||||
}
|
||||
val TextSourceSerializer = TextSourceSerializer
|
||||
|
@ -1,17 +1,15 @@
|
||||
package dev.inmo.tgbotapi.types.MessageEntity.textsources
|
||||
|
||||
import dev.inmo.tgbotapi.utils.RiskFeature
|
||||
import kotlin.js.JsName
|
||||
import kotlin.jvm.JvmName
|
||||
|
||||
@RiskFeature
|
||||
inline fun textSourcesOrElse(
|
||||
textSources: TextSourcesList,
|
||||
block: () -> TextSourcesList
|
||||
): TextSourcesList = textSources.takeIf { it.isNotEmpty() } ?: block()
|
||||
) = dev.inmo.tgbotapi.types.message.textsources.textSourcesOrElse(textSources, block)
|
||||
|
||||
@RiskFeature
|
||||
inline fun textSourcesOrElseTextSource(
|
||||
textSources: TextSourcesList,
|
||||
block: () -> TextSource
|
||||
): TextSourcesList = textSources.takeIf { it.isNotEmpty() } ?: listOf(block())
|
||||
) = dev.inmo.tgbotapi.types.message.textsources.textSourcesOrElseTextSource(textSources, block)
|
||||
|
@ -1,20 +1,13 @@
|
||||
package dev.inmo.tgbotapi.types.MessageEntity.textsources
|
||||
|
||||
import dev.inmo.tgbotapi.utils.RiskFeature
|
||||
import dev.inmo.tgbotapi.utils.internal.*
|
||||
import kotlinx.serialization.Serializable
|
||||
import dev.inmo.tgbotapi.utils.internal.link
|
||||
|
||||
/**
|
||||
* @see link
|
||||
*/
|
||||
@Serializable
|
||||
data class URLTextSource @RiskFeature(DirectInvocationOfTextSourceConstructor) constructor (
|
||||
override val source: String
|
||||
) : TextSource {
|
||||
override val markdown: String by lazy { source.linkMarkdown(source) }
|
||||
override val markdownV2: String by lazy { source.linkMarkdownV2(source) }
|
||||
override val html: String by lazy { source.linkHTML(source) }
|
||||
}
|
||||
@Deprecated("Replaced", ReplaceWith("URLTextSource", "dev.inmo.tgbotapi.types.message.textsources.URLTextSource"))
|
||||
typealias URLTextSource = dev.inmo.tgbotapi.types.message.textsources.URLTextSource
|
||||
|
||||
@Suppress("NOTHING_TO_INLINE")
|
||||
inline fun link(url: String) = URLTextSource(url)
|
||||
@Deprecated("Replaced", ReplaceWith("link", "dev.inmo.tgbotapi.types.message.textsources.link"))
|
||||
inline fun link(url: String) = dev.inmo.tgbotapi.types.message.textsources.link(url)
|
||||
|
@ -1,26 +1,19 @@
|
||||
package dev.inmo.tgbotapi.types.MessageEntity.textsources
|
||||
|
||||
import dev.inmo.tgbotapi.utils.RiskFeature
|
||||
import dev.inmo.tgbotapi.utils.extensions.makeString
|
||||
import dev.inmo.tgbotapi.utils.internal.*
|
||||
import kotlinx.serialization.Serializable
|
||||
import dev.inmo.tgbotapi.utils.internal.underline
|
||||
|
||||
/**
|
||||
* @see underline
|
||||
*/
|
||||
@Serializable
|
||||
data class UnderlineTextSource @RiskFeature(DirectInvocationOfTextSourceConstructor) constructor (
|
||||
override val source: String,
|
||||
override val subsources: TextSourcesList
|
||||
) : MultilevelTextSource {
|
||||
override val markdown: String by lazy { source.underlineMarkdown() }
|
||||
override val markdownV2: String by lazy { underlineMarkdownV2() }
|
||||
override val html: String by lazy { underlineHTML() }
|
||||
}
|
||||
@Deprecated("Replaced", ReplaceWith("UnderlineTextSource", "dev.inmo.tgbotapi.types.message.textsources.UnderlineTextSource"))
|
||||
typealias UnderlineTextSource = dev.inmo.tgbotapi.types.message.textsources.UnderlineTextSource
|
||||
|
||||
@Suppress("NOTHING_TO_INLINE")
|
||||
inline fun underline(parts: TextSourcesList) = UnderlineTextSource(parts.makeString(), parts)
|
||||
@Deprecated("Replaced", ReplaceWith("underline", "dev.inmo.tgbotapi.types.message.textsources.underline"))
|
||||
inline fun underline(parts: TextSourcesList) = dev.inmo.tgbotapi.types.message.textsources.underline(parts)
|
||||
@Suppress("NOTHING_TO_INLINE")
|
||||
inline fun underline(vararg parts: TextSource) = underline(parts.toList())
|
||||
@Deprecated("Replaced", ReplaceWith("underline", "dev.inmo.tgbotapi.types.message.textsources.underline"))
|
||||
inline fun underline(vararg parts: TextSource) = dev.inmo.tgbotapi.types.message.textsources.underline(*parts)
|
||||
@Suppress("NOTHING_TO_INLINE")
|
||||
inline fun underline(text: String) = underline(regular(text))
|
||||
@Deprecated("Replaced", ReplaceWith("underline", "dev.inmo.tgbotapi.types.message.textsources.underline"))
|
||||
inline fun underline(text: String) = dev.inmo.tgbotapi.types.message.textsources.underline(text)
|
||||
|
@ -3,7 +3,7 @@ package dev.inmo.tgbotapi.types.files
|
||||
import dev.inmo.tgbotapi.requests.abstracts.FileId
|
||||
import dev.inmo.tgbotapi.types.*
|
||||
import dev.inmo.tgbotapi.types.media.TelegramMediaVideo
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSourcesList
|
||||
import dev.inmo.tgbotapi.types.message.textsources.TextSourcesList
|
||||
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
||||
import dev.inmo.tgbotapi.utils.MimeType
|
||||
import kotlinx.serialization.SerialName
|
||||
|
@ -2,7 +2,7 @@ package dev.inmo.tgbotapi.types.games
|
||||
|
||||
import dev.inmo.tgbotapi.CommonAbstracts.TextedInput
|
||||
import dev.inmo.tgbotapi.CommonAbstracts.Titled
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSourcesList
|
||||
import dev.inmo.tgbotapi.types.message.textsources.TextSourcesList
|
||||
import dev.inmo.tgbotapi.types.files.AnimationFile
|
||||
import dev.inmo.tgbotapi.types.files.Photo
|
||||
import kotlinx.serialization.Serializable
|
||||
|
@ -1,8 +1,8 @@
|
||||
package dev.inmo.tgbotapi.types.games
|
||||
|
||||
import dev.inmo.tgbotapi.types.*
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.RawMessageEntities
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.asTextSources
|
||||
import dev.inmo.tgbotapi.types.message.RawMessageEntities
|
||||
import dev.inmo.tgbotapi.types.message.asTextSources
|
||||
import dev.inmo.tgbotapi.types.files.*
|
||||
import kotlinx.serialization.*
|
||||
|
||||
|
@ -4,10 +4,12 @@ import dev.inmo.tgbotapi.CommonAbstracts.TextedOutput
|
||||
import dev.inmo.tgbotapi.requests.abstracts.InputFile
|
||||
import dev.inmo.tgbotapi.requests.abstracts.fileIdToSend
|
||||
import dev.inmo.tgbotapi.types.*
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.*
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSourcesList
|
||||
import dev.inmo.tgbotapi.types.message.textsources.TextSourcesList
|
||||
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
||||
import dev.inmo.tgbotapi.types.ParseMode.parseModeField
|
||||
import dev.inmo.tgbotapi.types.message.*
|
||||
import dev.inmo.tgbotapi.types.message.RawMessageEntity
|
||||
import dev.inmo.tgbotapi.types.message.toRawMessageEntities
|
||||
import dev.inmo.tgbotapi.utils.extensions.makeString
|
||||
import kotlinx.serialization.SerialName
|
||||
import kotlinx.serialization.Serializable
|
||||
|
@ -4,11 +4,13 @@ import dev.inmo.tgbotapi.CommonAbstracts.Performerable
|
||||
import dev.inmo.tgbotapi.requests.abstracts.InputFile
|
||||
import dev.inmo.tgbotapi.requests.abstracts.fileIdToSend
|
||||
import dev.inmo.tgbotapi.types.*
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.*
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSourcesList
|
||||
import dev.inmo.tgbotapi.types.message.textsources.TextSourcesList
|
||||
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
||||
import dev.inmo.tgbotapi.types.ParseMode.parseModeField
|
||||
import dev.inmo.tgbotapi.types.files.AudioFile
|
||||
import dev.inmo.tgbotapi.types.message.*
|
||||
import dev.inmo.tgbotapi.types.message.RawMessageEntity
|
||||
import dev.inmo.tgbotapi.types.message.toRawMessageEntities
|
||||
import dev.inmo.tgbotapi.utils.extensions.makeString
|
||||
import kotlinx.serialization.*
|
||||
|
||||
|
@ -2,11 +2,13 @@ package dev.inmo.tgbotapi.types.media
|
||||
|
||||
import dev.inmo.tgbotapi.requests.abstracts.*
|
||||
import dev.inmo.tgbotapi.types.*
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.*
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSourcesList
|
||||
import dev.inmo.tgbotapi.types.message.textsources.TextSourcesList
|
||||
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
||||
import dev.inmo.tgbotapi.types.ParseMode.parseModeField
|
||||
import dev.inmo.tgbotapi.types.files.DocumentFile
|
||||
import dev.inmo.tgbotapi.types.message.*
|
||||
import dev.inmo.tgbotapi.types.message.RawMessageEntity
|
||||
import dev.inmo.tgbotapi.types.message.toRawMessageEntities
|
||||
import dev.inmo.tgbotapi.utils.extensions.makeString
|
||||
import kotlinx.serialization.*
|
||||
|
||||
|
@ -3,11 +3,13 @@ package dev.inmo.tgbotapi.types.media
|
||||
import dev.inmo.tgbotapi.requests.abstracts.InputFile
|
||||
import dev.inmo.tgbotapi.requests.abstracts.fileIdToSend
|
||||
import dev.inmo.tgbotapi.types.*
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.*
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSourcesList
|
||||
import dev.inmo.tgbotapi.types.message.textsources.TextSourcesList
|
||||
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
||||
import dev.inmo.tgbotapi.types.ParseMode.parseModeField
|
||||
import dev.inmo.tgbotapi.types.files.PhotoSize
|
||||
import dev.inmo.tgbotapi.types.message.*
|
||||
import dev.inmo.tgbotapi.types.message.RawMessageEntity
|
||||
import dev.inmo.tgbotapi.types.message.toRawMessageEntities
|
||||
import dev.inmo.tgbotapi.utils.extensions.makeString
|
||||
import kotlinx.serialization.*
|
||||
|
||||
|
@ -3,10 +3,12 @@ package dev.inmo.tgbotapi.types.media
|
||||
import dev.inmo.tgbotapi.requests.abstracts.InputFile
|
||||
import dev.inmo.tgbotapi.requests.abstracts.fileIdToSend
|
||||
import dev.inmo.tgbotapi.types.*
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.*
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSourcesList
|
||||
import dev.inmo.tgbotapi.types.message.textsources.TextSourcesList
|
||||
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
||||
import dev.inmo.tgbotapi.types.ParseMode.parseModeField
|
||||
import dev.inmo.tgbotapi.types.message.*
|
||||
import dev.inmo.tgbotapi.types.message.RawMessageEntity
|
||||
import dev.inmo.tgbotapi.types.message.toRawMessageEntities
|
||||
import dev.inmo.tgbotapi.utils.extensions.makeString
|
||||
import kotlinx.serialization.*
|
||||
|
||||
|
@ -1,8 +1,6 @@
|
||||
package dev.inmo.tgbotapi.types.message
|
||||
|
||||
import dev.inmo.tgbotapi.types.*
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.RawMessageEntities
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.asTextSources
|
||||
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
|
||||
import dev.inmo.tgbotapi.types.chat.*
|
||||
import dev.inmo.tgbotapi.types.chat.CommonBot
|
||||
|
@ -1,7 +1,7 @@
|
||||
package dev.inmo.tgbotapi.types.MessageEntity
|
||||
package dev.inmo.tgbotapi.types.message
|
||||
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.textsources.*
|
||||
import dev.inmo.tgbotapi.types.chat.User
|
||||
import dev.inmo.tgbotapi.types.message.textsources.*
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
@Serializable
|
||||
@ -177,12 +177,6 @@ internal fun TextSourcesList.toRawMessageEntities(preOffset: Int = 0): List<RawM
|
||||
}
|
||||
}
|
||||
|
||||
fun String.removeLeading(word: String) = if (startsWith(word)) {
|
||||
substring(word.length)
|
||||
} else {
|
||||
this
|
||||
}
|
||||
|
||||
internal fun TextSourcesList.toRawMessageEntities(): List<RawMessageEntity> = toRawMessageEntities(0)
|
||||
|
||||
internal fun RawMessageEntities.asTextSources(sourceString: String): TextSourcesList =
|
@ -4,4 +4,4 @@ import dev.inmo.tgbotapi.types.message.payments.abstracts.PaymentInfo
|
||||
|
||||
interface PossiblyPaymentMessage : Message {
|
||||
val paymentInfo: PaymentInfo?
|
||||
}
|
||||
}
|
||||
|
@ -4,7 +4,7 @@ import dev.inmo.tgbotapi.requests.abstracts.Request
|
||||
import dev.inmo.tgbotapi.requests.send.media.SendAnimation
|
||||
import dev.inmo.tgbotapi.types.ChatIdentifier
|
||||
import dev.inmo.tgbotapi.types.media.TelegramMediaAnimation
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSourcesList
|
||||
import dev.inmo.tgbotapi.types.message.textsources.TextSourcesList
|
||||
import dev.inmo.tgbotapi.types.MessageIdentifier
|
||||
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
|
||||
import dev.inmo.tgbotapi.types.files.AnimationFile
|
||||
|
@ -5,7 +5,7 @@ import dev.inmo.tgbotapi.requests.send.media.SendAudio
|
||||
import dev.inmo.tgbotapi.types.ChatIdentifier
|
||||
import dev.inmo.tgbotapi.types.media.TelegramMediaAudio
|
||||
import dev.inmo.tgbotapi.types.media.toTelegramMediaAudio
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSourcesList
|
||||
import dev.inmo.tgbotapi.types.message.textsources.TextSourcesList
|
||||
import dev.inmo.tgbotapi.types.MessageIdentifier
|
||||
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
|
||||
import dev.inmo.tgbotapi.types.files.AudioFile
|
||||
|
@ -6,7 +6,7 @@ import dev.inmo.tgbotapi.requests.send.media.SendDocument
|
||||
import dev.inmo.tgbotapi.types.ChatIdentifier
|
||||
import dev.inmo.tgbotapi.types.media.TelegramMediaDocument
|
||||
import dev.inmo.tgbotapi.types.media.toTelegramMediaDocument
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSourcesList
|
||||
import dev.inmo.tgbotapi.types.message.textsources.TextSourcesList
|
||||
import dev.inmo.tgbotapi.types.MessageIdentifier
|
||||
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
|
||||
import dev.inmo.tgbotapi.types.files.DocumentFile
|
||||
|
@ -5,7 +5,7 @@ import dev.inmo.tgbotapi.requests.send.media.SendPhoto
|
||||
import dev.inmo.tgbotapi.types.ChatIdentifier
|
||||
import dev.inmo.tgbotapi.types.media.TelegramMediaPhoto
|
||||
import dev.inmo.tgbotapi.types.media.toTelegramMediaPhoto
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSourcesList
|
||||
import dev.inmo.tgbotapi.types.message.textsources.TextSourcesList
|
||||
import dev.inmo.tgbotapi.types.MessageIdentifier
|
||||
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
|
||||
import dev.inmo.tgbotapi.types.files.*
|
||||
|
@ -4,7 +4,7 @@ import dev.inmo.tgbotapi.CommonAbstracts.TextedInput
|
||||
import dev.inmo.tgbotapi.requests.abstracts.Request
|
||||
import dev.inmo.tgbotapi.requests.send.SendTextMessage
|
||||
import dev.inmo.tgbotapi.types.ChatIdentifier
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSourcesList
|
||||
import dev.inmo.tgbotapi.types.message.textsources.TextSourcesList
|
||||
import dev.inmo.tgbotapi.types.MessageIdentifier
|
||||
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage
|
||||
|
@ -4,7 +4,7 @@ import dev.inmo.tgbotapi.requests.abstracts.Request
|
||||
import dev.inmo.tgbotapi.requests.send.media.SendVideo
|
||||
import dev.inmo.tgbotapi.types.ChatIdentifier
|
||||
import dev.inmo.tgbotapi.types.media.TelegramMediaVideo
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSourcesList
|
||||
import dev.inmo.tgbotapi.types.message.textsources.TextSourcesList
|
||||
import dev.inmo.tgbotapi.types.MessageIdentifier
|
||||
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
|
||||
import dev.inmo.tgbotapi.types.files.VideoFile
|
||||
|
@ -4,7 +4,7 @@ import dev.inmo.tgbotapi.requests.abstracts.Request
|
||||
import dev.inmo.tgbotapi.requests.send.media.SendVoice
|
||||
import dev.inmo.tgbotapi.types.ChatIdentifier
|
||||
import dev.inmo.tgbotapi.types.media.TelegramMediaAudio
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSourcesList
|
||||
import dev.inmo.tgbotapi.types.message.textsources.TextSourcesList
|
||||
import dev.inmo.tgbotapi.types.MessageIdentifier
|
||||
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
|
||||
import dev.inmo.tgbotapi.types.files.VoiceFile
|
||||
|
@ -0,0 +1,26 @@
|
||||
package dev.inmo.tgbotapi.types.message.textsources
|
||||
|
||||
import dev.inmo.tgbotapi.utils.RiskFeature
|
||||
import dev.inmo.tgbotapi.utils.extensions.makeString
|
||||
import dev.inmo.tgbotapi.utils.internal.*
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
/**
|
||||
* @see bold
|
||||
*/
|
||||
@Serializable
|
||||
data class BoldTextSource @RiskFeature(DirectInvocationOfTextSourceConstructor) constructor (
|
||||
override val source: String,
|
||||
override val subsources: TextSourcesList
|
||||
) : MultilevelTextSource {
|
||||
override val markdown: String by lazy { source.boldMarkdown() }
|
||||
override val markdownV2: String by lazy { boldMarkdownV2() }
|
||||
override val html: String by lazy { boldHTML() }
|
||||
}
|
||||
|
||||
@Suppress("NOTHING_TO_INLINE")
|
||||
inline fun bold(parts: TextSourcesList) = BoldTextSource(parts.makeString(), parts)
|
||||
@Suppress("NOTHING_TO_INLINE")
|
||||
inline fun bold(vararg parts: TextSource) = bold(parts.toList())
|
||||
@Suppress("NOTHING_TO_INLINE")
|
||||
inline fun bold(text: String) = bold(regular(text))
|
@ -0,0 +1,29 @@
|
||||
package dev.inmo.tgbotapi.types.message.textsources
|
||||
|
||||
import dev.inmo.tgbotapi.utils.RiskFeature
|
||||
import dev.inmo.tgbotapi.utils.internal.*
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
private val commandRegex = Regex("[/!][^@\\s]*")
|
||||
|
||||
/**
|
||||
* @see botCommand
|
||||
*/
|
||||
@Serializable
|
||||
data class BotCommandTextSource @RiskFeature(DirectInvocationOfTextSourceConstructor) constructor (
|
||||
override val source: String
|
||||
) : TextSource {
|
||||
val command: String by lazy {
|
||||
commandRegex.find(source) ?.value ?.substring(1) ?: source.substring(1)// skip first symbol like "/" or "!"
|
||||
}
|
||||
|
||||
override val markdown: String by lazy { source.commandMarkdown() }
|
||||
override val markdownV2: String by lazy { source.commandMarkdownV2() }
|
||||
override val html: String by lazy { source.commandHTML() }
|
||||
}
|
||||
|
||||
/**
|
||||
* @param command Without leading "/"
|
||||
*/
|
||||
@Suppress("NOTHING_TO_INLINE")
|
||||
inline fun botCommand(command: String) = BotCommandTextSource("/$command")
|
@ -0,0 +1,26 @@
|
||||
package dev.inmo.tgbotapi.types.message.textsources
|
||||
|
||||
import dev.inmo.tgbotapi.utils.RiskFeature
|
||||
import dev.inmo.tgbotapi.utils.extensions.makeString
|
||||
import dev.inmo.tgbotapi.utils.internal.*
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
/**
|
||||
* @see cashTag
|
||||
*/
|
||||
@Serializable
|
||||
data class CashTagTextSource @RiskFeature(DirectInvocationOfTextSourceConstructor) constructor (
|
||||
override val source: String,
|
||||
override val subsources: TextSourcesList
|
||||
) : MultilevelTextSource {
|
||||
override val markdown: String by lazy { source.cashTagMarkdown() }
|
||||
override val markdownV2: String by lazy { cashTagMarkdownV2() }
|
||||
override val html: String by lazy { cashTagHTML() }
|
||||
}
|
||||
|
||||
@Suppress("NOTHING_TO_INLINE")
|
||||
inline fun cashTag(parts: TextSourcesList) = CashTagTextSource(parts.makeString(), parts)
|
||||
@Suppress("NOTHING_TO_INLINE")
|
||||
inline fun cashTag(vararg parts: TextSource) = cashTag(parts.toList())
|
||||
@Suppress("NOTHING_TO_INLINE")
|
||||
inline fun cashTag(tag: String) = cashTag(regular(tag))
|
@ -0,0 +1,20 @@
|
||||
package dev.inmo.tgbotapi.types.message.textsources
|
||||
|
||||
import dev.inmo.tgbotapi.utils.RiskFeature
|
||||
import dev.inmo.tgbotapi.utils.internal.*
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
/**
|
||||
* @see code
|
||||
*/
|
||||
@Serializable
|
||||
data class CodeTextSource @RiskFeature(DirectInvocationOfTextSourceConstructor) constructor (
|
||||
override val source: String
|
||||
) : TextSource {
|
||||
override val markdown: String by lazy { source.codeMarkdown() }
|
||||
override val markdownV2: String by lazy { source.codeMarkdownV2() }
|
||||
override val html: String by lazy { source.codeHTML() }
|
||||
}
|
||||
|
||||
@Suppress("NOTHING_TO_INLINE")
|
||||
inline fun code(code: String) = CodeTextSource(code)
|
@ -0,0 +1,26 @@
|
||||
package dev.inmo.tgbotapi.types.message.textsources
|
||||
|
||||
import dev.inmo.tgbotapi.utils.RiskFeature
|
||||
import dev.inmo.tgbotapi.utils.extensions.makeString
|
||||
import dev.inmo.tgbotapi.utils.internal.*
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
/**
|
||||
* @see email
|
||||
*/
|
||||
@Serializable
|
||||
data class EMailTextSource @RiskFeature(DirectInvocationOfTextSourceConstructor) constructor (
|
||||
override val source: String,
|
||||
override val subsources: TextSourcesList
|
||||
) : MultilevelTextSource {
|
||||
override val markdown: String by lazy { source.emailMarkdown() }
|
||||
override val markdownV2: String by lazy { emailMarkdownV2(source) }
|
||||
override val html: String by lazy { emailHTML(source) }
|
||||
}
|
||||
|
||||
@Suppress("NOTHING_TO_INLINE")
|
||||
inline fun email(parts: TextSourcesList) = EMailTextSource(parts.makeString(), parts)
|
||||
@Suppress("NOTHING_TO_INLINE")
|
||||
inline fun email(vararg parts: TextSource) = email(parts.toList())
|
||||
@Suppress("NOTHING_TO_INLINE")
|
||||
inline fun email(emailAddress: String) = email(regular(emailAddress))
|
@ -0,0 +1,35 @@
|
||||
package dev.inmo.tgbotapi.types.message.textsources
|
||||
|
||||
import dev.inmo.tgbotapi.utils.RiskFeature
|
||||
import dev.inmo.tgbotapi.utils.extensions.makeString
|
||||
import dev.inmo.tgbotapi.utils.internal.*
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
/**
|
||||
* @see hashtag
|
||||
*/
|
||||
@Serializable
|
||||
data class HashTagTextSource @RiskFeature(DirectInvocationOfTextSourceConstructor) constructor (
|
||||
override val source: String,
|
||||
override val subsources: TextSourcesList
|
||||
) : MultilevelTextSource {
|
||||
override val markdown: String by lazy { source.hashTagMarkdown() }
|
||||
override val markdownV2: String by lazy { hashTagMarkdownV2() }
|
||||
override val html: String by lazy { hashTagHTML() }
|
||||
|
||||
init {
|
||||
if (!source.startsWith("#")) {
|
||||
error("HashTag source must starts with #, but actual value is \"$source\"")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Suppress("NOTHING_TO_INLINE", "EXPERIMENTAL_API_USAGE")
|
||||
inline fun hashtag(parts: TextSourcesList) = (regular("#") + parts).let { HashTagTextSource(it.makeString(), it) }
|
||||
@Suppress("NOTHING_TO_INLINE")
|
||||
inline fun hashtag(vararg parts: TextSource) = hashtag(parts.toList())
|
||||
/**
|
||||
* Without sharp (#)
|
||||
*/
|
||||
@Suppress("NOTHING_TO_INLINE")
|
||||
inline fun hashtag(hashtag: String) = hashtag(regular(hashtag))
|
@ -0,0 +1,27 @@
|
||||
package dev.inmo.tgbotapi.types.message.textsources
|
||||
|
||||
import dev.inmo.tgbotapi.utils.RiskFeature
|
||||
import dev.inmo.tgbotapi.utils.extensions.makeString
|
||||
import dev.inmo.tgbotapi.utils.internal.*
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
/**
|
||||
* @see italic
|
||||
*/
|
||||
@Serializable
|
||||
data class ItalicTextSource @RiskFeature(DirectInvocationOfTextSourceConstructor) constructor (
|
||||
override val source: String,
|
||||
override val subsources: TextSourcesList
|
||||
) : MultilevelTextSource {
|
||||
override val markdown: String by lazy { source.italicMarkdown() }
|
||||
override val markdownV2: String by lazy { italicMarkdownV2() }
|
||||
override val html: String by lazy { italicHTML() }
|
||||
}
|
||||
|
||||
@Suppress("NOTHING_TO_INLINE")
|
||||
inline fun italic(parts: TextSourcesList) = ItalicTextSource(parts.makeString(), parts)
|
||||
@Suppress("NOTHING_TO_INLINE")
|
||||
inline fun italic(vararg parts: TextSource) = italic(parts.toList())
|
||||
@Suppress("NOTHING_TO_INLINE")
|
||||
inline fun italic(text: String) = italic(regular(text))
|
||||
|
@ -0,0 +1,49 @@
|
||||
package dev.inmo.tgbotapi.types.message.textsources
|
||||
|
||||
import dev.inmo.tgbotapi.types.Username
|
||||
import dev.inmo.tgbotapi.utils.RiskFeature
|
||||
import dev.inmo.tgbotapi.utils.extensions.makeString
|
||||
import dev.inmo.tgbotapi.utils.internal.*
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
private val String.withoutCommercialAt
|
||||
get() = if (startsWith("@")) {
|
||||
substring(1)
|
||||
} else {
|
||||
this
|
||||
}
|
||||
|
||||
/**
|
||||
* @see mention
|
||||
*/
|
||||
@Serializable
|
||||
data class MentionTextSource @RiskFeature(DirectInvocationOfTextSourceConstructor) constructor (
|
||||
override val source: String,
|
||||
override val subsources: TextSourcesList
|
||||
) : MultilevelTextSource {
|
||||
override val markdown: String by lazy { source.mentionMarkdown() }
|
||||
override val markdownV2: String by lazy { mentionMarkdownV2() }
|
||||
override val html: String by lazy { mentionHTML() }
|
||||
val username: Username = Username(source)
|
||||
|
||||
init {
|
||||
if (!source.startsWith("@")) {
|
||||
error("Mention source must starts with @, but actual value is \"$source\"")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Suppress("NOTHING_TO_INLINE")
|
||||
inline fun mention(parts: TextSourcesList) = (regular("@") + parts).let { MentionTextSource(it.makeString(), it) }
|
||||
@Suppress("NOTHING_TO_INLINE")
|
||||
inline fun mention(vararg parts: TextSource) = mention(parts.toList())
|
||||
|
||||
/**
|
||||
* Without leading "@"
|
||||
*/
|
||||
@Suppress("NOTHING_TO_INLINE")
|
||||
inline fun mention(whoToMention: String) = mention(regular(whoToMention))
|
||||
|
||||
@Suppress("NOTHING_TO_INLINE")
|
||||
inline fun mention(whoToMention: Username) = mention(whoToMention.username.dropWhile { it == '@' })
|
||||
|
@ -0,0 +1,27 @@
|
||||
package dev.inmo.tgbotapi.types.message.textsources
|
||||
|
||||
import dev.inmo.tgbotapi.utils.RiskFeature
|
||||
import dev.inmo.tgbotapi.utils.extensions.makeString
|
||||
import dev.inmo.tgbotapi.utils.internal.*
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
/**
|
||||
* @see phone
|
||||
*/
|
||||
@Serializable
|
||||
data class PhoneNumberTextSource @RiskFeature(DirectInvocationOfTextSourceConstructor) constructor (
|
||||
override val source: String,
|
||||
override val subsources: TextSourcesList
|
||||
) : MultilevelTextSource {
|
||||
override val markdown: String by lazy { source.phoneMarkdown() }
|
||||
override val markdownV2: String by lazy { phoneMarkdownV2() }
|
||||
override val html: String by lazy { phoneHTML() }
|
||||
}
|
||||
|
||||
@Suppress("NOTHING_TO_INLINE")
|
||||
inline fun phone(parts: TextSourcesList) = PhoneNumberTextSource(parts.makeString(), parts)
|
||||
@Suppress("NOTHING_TO_INLINE")
|
||||
inline fun phone(vararg parts: TextSource) = phone(parts.toList())
|
||||
@Suppress("NOTHING_TO_INLINE")
|
||||
inline fun phone(number: String) = phone(regular(number))
|
||||
|
@ -0,0 +1,22 @@
|
||||
package dev.inmo.tgbotapi.types.message.textsources
|
||||
|
||||
import dev.inmo.tgbotapi.utils.RiskFeature
|
||||
import dev.inmo.tgbotapi.utils.internal.*
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
/**
|
||||
* @see pre
|
||||
*/
|
||||
@Serializable
|
||||
data class PreTextSource @RiskFeature(DirectInvocationOfTextSourceConstructor) constructor (
|
||||
override val source: String,
|
||||
val language: String? = null
|
||||
) : TextSource {
|
||||
override val markdown: String by lazy { source.preMarkdown(language) }
|
||||
override val markdownV2: String by lazy { source.preMarkdownV2(language) }
|
||||
override val html: String by lazy { source.preHTML(language) }
|
||||
}
|
||||
|
||||
@Suppress("NOTHING_TO_INLINE")
|
||||
inline fun pre(code: String, language: String? = null) = PreTextSource(code, language)
|
||||
|
@ -0,0 +1,20 @@
|
||||
package dev.inmo.tgbotapi.types.message.textsources
|
||||
|
||||
import dev.inmo.tgbotapi.utils.RiskFeature
|
||||
import dev.inmo.tgbotapi.utils.internal.*
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
/**
|
||||
* @see regular
|
||||
*/
|
||||
@Serializable
|
||||
data class RegularTextSource @RiskFeature(DirectInvocationOfTextSourceConstructor) constructor (
|
||||
override val source: String
|
||||
) : TextSource {
|
||||
override val markdown: String by lazy { source.regularMarkdown() }
|
||||
override val markdownV2: String by lazy { source.regularMarkdownV2() }
|
||||
override val html: String by lazy { source.regularHtml() }
|
||||
}
|
||||
|
||||
@Suppress("NOTHING_TO_INLINE")
|
||||
inline fun regular(text: String) = RegularTextSource(text)
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user