mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2024-11-29 13:38:43 +00:00
partially complete rewriting of things according to #189
This commit is contained in:
parent
eb879963f8
commit
c0e81b1d6d
@ -7,10 +7,16 @@ interface Explained {
|
|||||||
val explanation: String?
|
val explanation: String?
|
||||||
}
|
}
|
||||||
|
|
||||||
interface ExplainedOutput : Explained {
|
interface ParsableExplainedOutput : Explained {
|
||||||
val parseMode: ParseMode?
|
val parseMode: ParseMode?
|
||||||
}
|
}
|
||||||
|
|
||||||
|
interface EntitiesExplainedOutput : Explained {
|
||||||
|
val entities: List<TextSource>?
|
||||||
|
}
|
||||||
|
|
||||||
|
interface ExplainedOutput : ParsableExplainedOutput, EntitiesExplainedOutput
|
||||||
|
|
||||||
interface ExplainedInput : Explained {
|
interface ExplainedInput : Explained {
|
||||||
/**
|
/**
|
||||||
* Not full list of entities. This list WILL NOT contain [TextPart]s with [dev.inmo.tgbotapi.types.MessageEntity.textsources.RegularTextSource]
|
* Not full list of entities. This list WILL NOT contain [TextPart]s with [dev.inmo.tgbotapi.types.MessageEntity.textsources.RegularTextSource]
|
||||||
|
@ -21,3 +21,4 @@ data class TextPart(
|
|||||||
)
|
)
|
||||||
|
|
||||||
fun List<TextPart>.justTextSources() = map { it.source }
|
fun List<TextPart>.justTextSources() = map { it.source }
|
||||||
|
fun List<TextSource>.makeString() = joinToString("") { it.source }
|
||||||
|
@ -0,0 +1,32 @@
|
|||||||
|
package dev.inmo.tgbotapi.CommonAbstracts
|
||||||
|
|
||||||
|
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
||||||
|
import dev.inmo.tgbotapi.utils.fullListOfSubSource
|
||||||
|
|
||||||
|
interface Texted {
|
||||||
|
val text: String?
|
||||||
|
}
|
||||||
|
|
||||||
|
interface ParsableOutput : Texted {
|
||||||
|
val parseMode: ParseMode?
|
||||||
|
}
|
||||||
|
|
||||||
|
interface EntitiesOutput : Texted {
|
||||||
|
val entities: List<TextSource>?
|
||||||
|
}
|
||||||
|
|
||||||
|
interface TextedOutput : ParsableOutput, EntitiesOutput
|
||||||
|
|
||||||
|
interface TextedInput : Texted {
|
||||||
|
/**
|
||||||
|
* Not full list of entities. This list WILL NOT contain [TextPart]s with [dev.inmo.tgbotapi.types.MessageEntity.textsources.RegularTextSource]
|
||||||
|
* @see [CaptionedInput.fullEntitiesList]
|
||||||
|
*/
|
||||||
|
val textEntities: List<TextPart>
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convert its [TextedInput.textEntities] to list of [dev.inmo.tgbotapi.CommonAbstracts.TextSource]
|
||||||
|
* with [dev.inmo.tgbotapi.types.MessageEntity.textsources.RegularTextSource]
|
||||||
|
*/
|
||||||
|
fun TextedInput.fullEntitiesList(): FullTextSourcesList = text ?.fullListOfSubSource(textEntities) ?.map { it.source } ?: emptyList()
|
@ -1,8 +1,7 @@
|
|||||||
package dev.inmo.tgbotapi.requests.edit.abstracts
|
package dev.inmo.tgbotapi.requests.edit.abstracts
|
||||||
|
|
||||||
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
import dev.inmo.tgbotapi.CommonAbstracts.TextedOutput
|
||||||
|
|
||||||
interface EditTextChatMessage {
|
interface EditTextChatMessage : TextedOutput {
|
||||||
val text: String
|
override val text: String
|
||||||
val parseMode: ParseMode?
|
|
||||||
}
|
}
|
@ -1,8 +1,12 @@
|
|||||||
package dev.inmo.tgbotapi.requests.edit.caption
|
package dev.inmo.tgbotapi.requests.edit.caption
|
||||||
|
|
||||||
|
import dev.inmo.tgbotapi.CommonAbstracts.*
|
||||||
import dev.inmo.tgbotapi.requests.edit.abstracts.*
|
import dev.inmo.tgbotapi.requests.edit.abstracts.*
|
||||||
import dev.inmo.tgbotapi.requests.edit.media.MediaContentMessageResultDeserializer
|
import dev.inmo.tgbotapi.requests.edit.media.MediaContentMessageResultDeserializer
|
||||||
import dev.inmo.tgbotapi.types.*
|
import dev.inmo.tgbotapi.types.*
|
||||||
|
import dev.inmo.tgbotapi.types.MessageEntity.*
|
||||||
|
import dev.inmo.tgbotapi.types.MessageEntity.RawMessageEntity
|
||||||
|
import dev.inmo.tgbotapi.types.MessageEntity.asTextParts
|
||||||
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
||||||
import dev.inmo.tgbotapi.types.ParseMode.parseModeField
|
import dev.inmo.tgbotapi.types.ParseMode.parseModeField
|
||||||
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
|
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
|
||||||
@ -12,8 +16,37 @@ import kotlinx.serialization.*
|
|||||||
|
|
||||||
const val editMessageCaptionMethod = "editMessageCaption"
|
const val editMessageCaptionMethod = "editMessageCaption"
|
||||||
|
|
||||||
|
fun EditChatMessageCaption(
|
||||||
|
chatId: ChatIdentifier,
|
||||||
|
messageId: MessageIdentifier,
|
||||||
|
text: String,
|
||||||
|
parseMode: ParseMode? = null,
|
||||||
|
replyMarkup: InlineKeyboardMarkup? = null
|
||||||
|
) = EditChatMessageCaption(
|
||||||
|
chatId,
|
||||||
|
messageId,
|
||||||
|
text,
|
||||||
|
parseMode,
|
||||||
|
null,
|
||||||
|
replyMarkup
|
||||||
|
)
|
||||||
|
|
||||||
|
fun EditChatMessageCaption(
|
||||||
|
chatId: ChatIdentifier,
|
||||||
|
messageId: MessageIdentifier,
|
||||||
|
entities: List<TextSource>,
|
||||||
|
replyMarkup: InlineKeyboardMarkup? = null
|
||||||
|
) = EditChatMessageCaption(
|
||||||
|
chatId,
|
||||||
|
messageId,
|
||||||
|
entities.makeString(),
|
||||||
|
null,
|
||||||
|
entities.toRawMessageEntities(),
|
||||||
|
replyMarkup
|
||||||
|
)
|
||||||
|
|
||||||
@Serializable
|
@Serializable
|
||||||
data class EditChatMessageCaption(
|
data class EditChatMessageCaption internal constructor(
|
||||||
@SerialName(chatIdField)
|
@SerialName(chatIdField)
|
||||||
override val chatId: ChatIdentifier,
|
override val chatId: ChatIdentifier,
|
||||||
@SerialName(messageIdField)
|
@SerialName(messageIdField)
|
||||||
@ -22,9 +55,14 @@ data class EditChatMessageCaption(
|
|||||||
override val text: String,
|
override val text: String,
|
||||||
@SerialName(parseModeField)
|
@SerialName(parseModeField)
|
||||||
override val parseMode: ParseMode? = null,
|
override val parseMode: ParseMode? = null,
|
||||||
|
@SerialName(captionEntitiesField)
|
||||||
|
private val rawEntities: List<RawMessageEntity>? = null,
|
||||||
@SerialName(replyMarkupField)
|
@SerialName(replyMarkupField)
|
||||||
override val replyMarkup: InlineKeyboardMarkup? = null
|
override val replyMarkup: InlineKeyboardMarkup? = null
|
||||||
) : EditChatMessage<MediaContent>, EditTextChatMessage, EditReplyMessage {
|
) : EditChatMessage<MediaContent>, EditTextChatMessage, EditReplyMessage {
|
||||||
|
override val entities: List<TextSource>? by lazy {
|
||||||
|
rawEntities ?.asTextParts(text) ?.justTextSources()
|
||||||
|
}
|
||||||
|
|
||||||
override fun method(): String = editMessageCaptionMethod
|
override fun method(): String = editMessageCaptionMethod
|
||||||
override val resultDeserializer: DeserializationStrategy<ContentMessage<MediaContent>>
|
override val resultDeserializer: DeserializationStrategy<ContentMessage<MediaContent>>
|
||||||
|
@ -1,23 +1,58 @@
|
|||||||
package dev.inmo.tgbotapi.requests.edit.caption
|
package dev.inmo.tgbotapi.requests.edit.caption
|
||||||
|
|
||||||
|
import dev.inmo.tgbotapi.CommonAbstracts.*
|
||||||
import dev.inmo.tgbotapi.requests.edit.abstracts.*
|
import dev.inmo.tgbotapi.requests.edit.abstracts.*
|
||||||
import dev.inmo.tgbotapi.types.*
|
import dev.inmo.tgbotapi.types.*
|
||||||
|
import dev.inmo.tgbotapi.types.MessageEntity.*
|
||||||
|
import dev.inmo.tgbotapi.types.MessageEntity.RawMessageEntity
|
||||||
|
import dev.inmo.tgbotapi.types.MessageEntity.asTextParts
|
||||||
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
||||||
import dev.inmo.tgbotapi.types.ParseMode.parseModeField
|
import dev.inmo.tgbotapi.types.ParseMode.parseModeField
|
||||||
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
|
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
|
||||||
import kotlinx.serialization.*
|
import kotlinx.serialization.*
|
||||||
|
|
||||||
|
fun EditInlineMessageCaption(
|
||||||
|
inlineMessageId: InlineMessageIdentifier,
|
||||||
|
text: String,
|
||||||
|
parseMode: ParseMode? = null,
|
||||||
|
replyMarkup: InlineKeyboardMarkup? = null
|
||||||
|
) = EditInlineMessageCaption(
|
||||||
|
inlineMessageId,
|
||||||
|
text,
|
||||||
|
parseMode,
|
||||||
|
null,
|
||||||
|
replyMarkup
|
||||||
|
)
|
||||||
|
|
||||||
|
fun EditInlineMessageCaption(
|
||||||
|
inlineMessageId: InlineMessageIdentifier,
|
||||||
|
entities: List<TextSource>,
|
||||||
|
replyMarkup: InlineKeyboardMarkup? = null
|
||||||
|
) = EditInlineMessageCaption(
|
||||||
|
inlineMessageId,
|
||||||
|
entities.makeString(),
|
||||||
|
null,
|
||||||
|
entities.toRawMessageEntities(),
|
||||||
|
replyMarkup
|
||||||
|
)
|
||||||
|
|
||||||
@Serializable
|
@Serializable
|
||||||
data class EditInlineMessageCaption(
|
data class EditInlineMessageCaption internal constructor(
|
||||||
@SerialName(inlineMessageIdField)
|
@SerialName(inlineMessageIdField)
|
||||||
override val inlineMessageId: InlineMessageIdentifier,
|
override val inlineMessageId: InlineMessageIdentifier,
|
||||||
@SerialName(captionField)
|
@SerialName(captionField)
|
||||||
override val text: String,
|
override val text: String,
|
||||||
@SerialName(parseModeField)
|
@SerialName(parseModeField)
|
||||||
override val parseMode: ParseMode? = null,
|
override val parseMode: ParseMode? = null,
|
||||||
|
@SerialName(captionEntitiesField)
|
||||||
|
private val rawEntities: List<RawMessageEntity>? = null,
|
||||||
@SerialName(replyMarkupField)
|
@SerialName(replyMarkupField)
|
||||||
override val replyMarkup: InlineKeyboardMarkup? = null
|
override val replyMarkup: InlineKeyboardMarkup? = null
|
||||||
) : EditInlineMessage, EditTextChatMessage, EditReplyMessage {
|
) : EditInlineMessage, EditTextChatMessage, EditReplyMessage {
|
||||||
|
override val entities: List<TextSource>? by lazy {
|
||||||
|
rawEntities ?.asTextParts(text) ?.justTextSources()
|
||||||
|
}
|
||||||
|
|
||||||
override fun method(): String = editMessageCaptionMethod
|
override fun method(): String = editMessageCaptionMethod
|
||||||
override val requestSerializer: SerializationStrategy<*>
|
override val requestSerializer: SerializationStrategy<*>
|
||||||
get() = serializer()
|
get() = serializer()
|
||||||
|
@ -1,8 +1,12 @@
|
|||||||
package dev.inmo.tgbotapi.requests.edit.text
|
package dev.inmo.tgbotapi.requests.edit.text
|
||||||
|
|
||||||
|
import dev.inmo.tgbotapi.CommonAbstracts.*
|
||||||
import dev.inmo.tgbotapi.requests.edit.abstracts.*
|
import dev.inmo.tgbotapi.requests.edit.abstracts.*
|
||||||
import dev.inmo.tgbotapi.requests.send.TextContentMessageResultDeserializer
|
import dev.inmo.tgbotapi.requests.send.TextContentMessageResultDeserializer
|
||||||
import dev.inmo.tgbotapi.types.*
|
import dev.inmo.tgbotapi.types.*
|
||||||
|
import dev.inmo.tgbotapi.types.MessageEntity.*
|
||||||
|
import dev.inmo.tgbotapi.types.MessageEntity.RawMessageEntity
|
||||||
|
import dev.inmo.tgbotapi.types.MessageEntity.toRawMessageEntities
|
||||||
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
||||||
import dev.inmo.tgbotapi.types.ParseMode.parseModeField
|
import dev.inmo.tgbotapi.types.ParseMode.parseModeField
|
||||||
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
|
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
|
||||||
@ -12,8 +16,41 @@ import kotlinx.serialization.*
|
|||||||
|
|
||||||
const val editMessageTextMethod = "editMessageText"
|
const val editMessageTextMethod = "editMessageText"
|
||||||
|
|
||||||
|
fun EditChatMessageText(
|
||||||
|
chatId: ChatIdentifier,
|
||||||
|
messageId: MessageIdentifier,
|
||||||
|
text: String,
|
||||||
|
parseMode: ParseMode? = null,
|
||||||
|
disableWebPagePreview: Boolean? = null,
|
||||||
|
replyMarkup: InlineKeyboardMarkup? = null
|
||||||
|
) = EditChatMessageText(
|
||||||
|
chatId,
|
||||||
|
messageId,
|
||||||
|
text,
|
||||||
|
parseMode,
|
||||||
|
null,
|
||||||
|
disableWebPagePreview,
|
||||||
|
replyMarkup
|
||||||
|
)
|
||||||
|
|
||||||
|
fun EditChatMessageText(
|
||||||
|
chatId: ChatIdentifier,
|
||||||
|
messageId: MessageIdentifier,
|
||||||
|
entities: List<TextSource>,
|
||||||
|
disableWebPagePreview: Boolean? = null,
|
||||||
|
replyMarkup: InlineKeyboardMarkup? = null
|
||||||
|
) = EditChatMessageText(
|
||||||
|
chatId,
|
||||||
|
messageId,
|
||||||
|
entities.makeString(),
|
||||||
|
null,
|
||||||
|
entities.toRawMessageEntities(),
|
||||||
|
disableWebPagePreview,
|
||||||
|
replyMarkup
|
||||||
|
)
|
||||||
|
|
||||||
@Serializable
|
@Serializable
|
||||||
data class EditChatMessageText(
|
data class EditChatMessageText internal constructor(
|
||||||
@SerialName(chatIdField)
|
@SerialName(chatIdField)
|
||||||
override val chatId: ChatIdentifier,
|
override val chatId: ChatIdentifier,
|
||||||
@SerialName(messageIdField)
|
@SerialName(messageIdField)
|
||||||
@ -22,11 +59,16 @@ data class EditChatMessageText(
|
|||||||
override val text: String,
|
override val text: String,
|
||||||
@SerialName(parseModeField)
|
@SerialName(parseModeField)
|
||||||
override val parseMode: ParseMode? = null,
|
override val parseMode: ParseMode? = null,
|
||||||
|
@SerialName(entitiesField)
|
||||||
|
private val rawEntities: List<RawMessageEntity>? = null,
|
||||||
@SerialName(disableWebPagePreviewField)
|
@SerialName(disableWebPagePreviewField)
|
||||||
override val disableWebPagePreview: Boolean? = null,
|
override val disableWebPagePreview: Boolean? = null,
|
||||||
@SerialName(replyMarkupField)
|
@SerialName(replyMarkupField)
|
||||||
override val replyMarkup: InlineKeyboardMarkup? = null
|
override val replyMarkup: InlineKeyboardMarkup? = null
|
||||||
) : EditChatMessage<TextContent>, EditTextChatMessage, EditReplyMessage, EditDisableWebPagePreviewMessage {
|
) : EditChatMessage<TextContent>, EditTextChatMessage, EditReplyMessage, EditDisableWebPagePreviewMessage {
|
||||||
|
override val entities: List<TextSource>? by lazy {
|
||||||
|
rawEntities ?.asTextParts(text) ?.justTextSources()
|
||||||
|
}
|
||||||
|
|
||||||
override fun method(): String = editMessageTextMethod
|
override fun method(): String = editMessageTextMethod
|
||||||
override val resultDeserializer: DeserializationStrategy<ContentMessage<TextContent>>
|
override val resultDeserializer: DeserializationStrategy<ContentMessage<TextContent>>
|
||||||
|
@ -1,26 +1,65 @@
|
|||||||
package dev.inmo.tgbotapi.requests.edit.text
|
package dev.inmo.tgbotapi.requests.edit.text
|
||||||
|
|
||||||
|
import dev.inmo.tgbotapi.CommonAbstracts.*
|
||||||
import dev.inmo.tgbotapi.requests.edit.abstracts.*
|
import dev.inmo.tgbotapi.requests.edit.abstracts.*
|
||||||
import dev.inmo.tgbotapi.requests.edit.media.editMessageMediaMethod
|
import dev.inmo.tgbotapi.requests.edit.media.editMessageMediaMethod
|
||||||
import dev.inmo.tgbotapi.types.*
|
import dev.inmo.tgbotapi.types.*
|
||||||
|
import dev.inmo.tgbotapi.types.MessageEntity.*
|
||||||
|
import dev.inmo.tgbotapi.types.MessageEntity.RawMessageEntity
|
||||||
|
import dev.inmo.tgbotapi.types.MessageEntity.toRawMessageEntities
|
||||||
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
||||||
import dev.inmo.tgbotapi.types.ParseMode.parseModeField
|
import dev.inmo.tgbotapi.types.ParseMode.parseModeField
|
||||||
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
|
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
|
||||||
import kotlinx.serialization.*
|
import kotlinx.serialization.*
|
||||||
|
|
||||||
|
fun EditInlineMessageText(
|
||||||
|
inlineMessageId: InlineMessageIdentifier,
|
||||||
|
text: String,
|
||||||
|
parseMode: ParseMode? = null,
|
||||||
|
disableWebPagePreview: Boolean? = null,
|
||||||
|
replyMarkup: InlineKeyboardMarkup? = null
|
||||||
|
) = EditInlineMessageText(
|
||||||
|
inlineMessageId,
|
||||||
|
text,
|
||||||
|
parseMode,
|
||||||
|
null,
|
||||||
|
disableWebPagePreview,
|
||||||
|
replyMarkup
|
||||||
|
)
|
||||||
|
|
||||||
|
fun EditInlineMessageText(
|
||||||
|
inlineMessageId: InlineMessageIdentifier,
|
||||||
|
entities: List<TextSource>,
|
||||||
|
disableWebPagePreview: Boolean? = null,
|
||||||
|
replyMarkup: InlineKeyboardMarkup? = null
|
||||||
|
) = EditInlineMessageText(
|
||||||
|
inlineMessageId,
|
||||||
|
entities.makeString(),
|
||||||
|
null,
|
||||||
|
entities.toRawMessageEntities(),
|
||||||
|
disableWebPagePreview,
|
||||||
|
replyMarkup
|
||||||
|
)
|
||||||
|
|
||||||
@Serializable
|
@Serializable
|
||||||
data class EditInlineMessageText(
|
data class EditInlineMessageText internal constructor(
|
||||||
@SerialName(inlineMessageIdField)
|
@SerialName(inlineMessageIdField)
|
||||||
override val inlineMessageId: InlineMessageIdentifier,
|
override val inlineMessageId: InlineMessageIdentifier,
|
||||||
@SerialName(textField)
|
@SerialName(textField)
|
||||||
override val text: String,
|
override val text: String,
|
||||||
@SerialName(parseModeField)
|
@SerialName(parseModeField)
|
||||||
override val parseMode: ParseMode? = null,
|
override val parseMode: ParseMode? = null,
|
||||||
|
@SerialName(entitiesField)
|
||||||
|
private val rawEntities: List<RawMessageEntity>? = null,
|
||||||
@SerialName(disableWebPagePreviewField)
|
@SerialName(disableWebPagePreviewField)
|
||||||
override val disableWebPagePreview: Boolean? = null,
|
override val disableWebPagePreview: Boolean? = null,
|
||||||
@SerialName(replyMarkupField)
|
@SerialName(replyMarkupField)
|
||||||
override val replyMarkup: InlineKeyboardMarkup? = null
|
override val replyMarkup: InlineKeyboardMarkup? = null
|
||||||
) : EditInlineMessage, EditTextChatMessage, EditReplyMessage, EditDisableWebPagePreviewMessage {
|
) : EditInlineMessage, EditTextChatMessage, EditReplyMessage, EditDisableWebPagePreviewMessage {
|
||||||
|
override val entities: List<TextSource>? by lazy {
|
||||||
|
rawEntities ?.asTextParts(text ?: return@lazy null) ?.justTextSources()
|
||||||
|
}
|
||||||
|
|
||||||
override fun method(): String = editMessageMediaMethod
|
override fun method(): String = editMessageMediaMethod
|
||||||
override val requestSerializer: SerializationStrategy<*>
|
override val requestSerializer: SerializationStrategy<*>
|
||||||
get() = serializer()
|
get() = serializer()
|
||||||
|
@ -1,8 +1,12 @@
|
|||||||
package dev.inmo.tgbotapi.requests.send
|
package dev.inmo.tgbotapi.requests.send
|
||||||
|
|
||||||
|
import dev.inmo.tgbotapi.CommonAbstracts.*
|
||||||
import dev.inmo.tgbotapi.CommonAbstracts.types.DisableWebPagePreview
|
import dev.inmo.tgbotapi.CommonAbstracts.types.DisableWebPagePreview
|
||||||
import dev.inmo.tgbotapi.requests.send.abstracts.*
|
import dev.inmo.tgbotapi.requests.send.abstracts.*
|
||||||
import dev.inmo.tgbotapi.types.*
|
import dev.inmo.tgbotapi.types.*
|
||||||
|
import dev.inmo.tgbotapi.types.MessageEntity.*
|
||||||
|
import dev.inmo.tgbotapi.types.MessageEntity.RawMessageEntity
|
||||||
|
import dev.inmo.tgbotapi.types.MessageEntity.asTextParts
|
||||||
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
||||||
import dev.inmo.tgbotapi.types.ParseMode.parseModeField
|
import dev.inmo.tgbotapi.types.ParseMode.parseModeField
|
||||||
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
|
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
|
||||||
@ -15,14 +19,53 @@ import kotlinx.serialization.*
|
|||||||
internal val TextContentMessageResultDeserializer: DeserializationStrategy<ContentMessage<TextContent>>
|
internal val TextContentMessageResultDeserializer: DeserializationStrategy<ContentMessage<TextContent>>
|
||||||
= TelegramBotAPIMessageDeserializationStrategyClass()
|
= TelegramBotAPIMessageDeserializationStrategyClass()
|
||||||
|
|
||||||
|
fun SendTextMessage(
|
||||||
|
chatId: ChatIdentifier,
|
||||||
|
text: String,
|
||||||
|
parseMode: ParseMode? = null,
|
||||||
|
disableWebPagePreview: Boolean? = null,
|
||||||
|
disableNotification: Boolean = false,
|
||||||
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
|
replyMarkup: KeyboardMarkup? = null
|
||||||
|
) = SendTextMessage(
|
||||||
|
chatId,
|
||||||
|
text,
|
||||||
|
parseMode,
|
||||||
|
null,
|
||||||
|
disableWebPagePreview,
|
||||||
|
disableNotification,
|
||||||
|
replyToMessageId,
|
||||||
|
replyMarkup
|
||||||
|
)
|
||||||
|
|
||||||
|
fun SendTextMessage(
|
||||||
|
chatId: ChatIdentifier,
|
||||||
|
entities: List<TextSource>,
|
||||||
|
disableWebPagePreview: Boolean? = null,
|
||||||
|
disableNotification: Boolean = false,
|
||||||
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
|
replyMarkup: KeyboardMarkup? = null
|
||||||
|
) = SendTextMessage(
|
||||||
|
chatId,
|
||||||
|
entities.makeString(),
|
||||||
|
null,
|
||||||
|
entities.toRawMessageEntities(),
|
||||||
|
disableWebPagePreview,
|
||||||
|
disableNotification,
|
||||||
|
replyToMessageId,
|
||||||
|
replyMarkup
|
||||||
|
)
|
||||||
|
|
||||||
@Serializable
|
@Serializable
|
||||||
data class SendTextMessage(
|
data class SendTextMessage internal constructor(
|
||||||
@SerialName(chatIdField)
|
@SerialName(chatIdField)
|
||||||
override val chatId: ChatIdentifier,
|
override val chatId: ChatIdentifier,
|
||||||
@SerialName(textField)
|
@SerialName(textField)
|
||||||
override val text: String,
|
override val text: String,
|
||||||
@SerialName(parseModeField)
|
@SerialName(parseModeField)
|
||||||
override val parseMode: ParseMode? = null,
|
override val parseMode: ParseMode? = null,
|
||||||
|
@SerialName(entitiesField)
|
||||||
|
private val rawEntities: List<RawMessageEntity>? = null,
|
||||||
@SerialName(disableWebPagePreviewField)
|
@SerialName(disableWebPagePreviewField)
|
||||||
override val disableWebPagePreview: Boolean? = null,
|
override val disableWebPagePreview: Boolean? = null,
|
||||||
@SerialName(disableNotificationField)
|
@SerialName(disableNotificationField)
|
||||||
@ -36,6 +79,10 @@ data class SendTextMessage(
|
|||||||
TextableSendMessageRequest<ContentMessage<TextContent>>,
|
TextableSendMessageRequest<ContentMessage<TextContent>>,
|
||||||
DisableWebPagePreview
|
DisableWebPagePreview
|
||||||
{
|
{
|
||||||
|
override val entities: List<TextSource>? by lazy {
|
||||||
|
rawEntities ?.asTextParts(text) ?.justTextSources()
|
||||||
|
}
|
||||||
|
|
||||||
init {
|
init {
|
||||||
if (text.length !in textLength) {
|
if (text.length !in textLength) {
|
||||||
throwRangeError("Text length", textLength, text.length)
|
throwRangeError("Text length", textLength, text.length)
|
||||||
|
@ -1,8 +1,5 @@
|
|||||||
package dev.inmo.tgbotapi.requests.send.abstracts
|
package dev.inmo.tgbotapi.requests.send.abstracts
|
||||||
|
|
||||||
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
import dev.inmo.tgbotapi.CommonAbstracts.TextedOutput
|
||||||
|
|
||||||
interface TextableSendMessageRequest<T: Any>: SendMessageRequest<T> {
|
interface TextableSendMessageRequest<T: Any>: SendMessageRequest<T>, TextedOutput
|
||||||
val text: String?
|
|
||||||
val parseMode: ParseMode?
|
|
||||||
}
|
|
||||||
|
@ -1,9 +1,13 @@
|
|||||||
package dev.inmo.tgbotapi.requests.send.media
|
package dev.inmo.tgbotapi.requests.send.media
|
||||||
|
|
||||||
|
import dev.inmo.tgbotapi.CommonAbstracts.*
|
||||||
import dev.inmo.tgbotapi.requests.abstracts.*
|
import dev.inmo.tgbotapi.requests.abstracts.*
|
||||||
import dev.inmo.tgbotapi.requests.send.abstracts.*
|
import dev.inmo.tgbotapi.requests.send.abstracts.*
|
||||||
import dev.inmo.tgbotapi.requests.send.media.base.*
|
import dev.inmo.tgbotapi.requests.send.media.base.*
|
||||||
import dev.inmo.tgbotapi.types.*
|
import dev.inmo.tgbotapi.types.*
|
||||||
|
import dev.inmo.tgbotapi.types.MessageEntity.*
|
||||||
|
import dev.inmo.tgbotapi.types.MessageEntity.RawMessageEntity
|
||||||
|
import dev.inmo.tgbotapi.types.MessageEntity.asTextParts
|
||||||
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
||||||
import dev.inmo.tgbotapi.types.ParseMode.parseModeField
|
import dev.inmo.tgbotapi.types.ParseMode.parseModeField
|
||||||
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
|
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
|
||||||
@ -38,6 +42,49 @@ fun SendAnimation(
|
|||||||
thumbAsFileId,
|
thumbAsFileId,
|
||||||
caption,
|
caption,
|
||||||
parseMode,
|
parseMode,
|
||||||
|
null,
|
||||||
|
duration,
|
||||||
|
width,
|
||||||
|
height,
|
||||||
|
disableNotification,
|
||||||
|
replyToMessageId,
|
||||||
|
replyMarkup
|
||||||
|
)
|
||||||
|
|
||||||
|
return if (animationAsFile == null && thumbAsFile == null) {
|
||||||
|
data
|
||||||
|
} else {
|
||||||
|
MultipartRequestImpl(
|
||||||
|
data,
|
||||||
|
SendAnimationFiles(animationAsFile, thumbAsFile)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun SendAnimation(
|
||||||
|
chatId: ChatIdentifier,
|
||||||
|
animation: InputFile,
|
||||||
|
thumb: InputFile? = null,
|
||||||
|
entities: List<TextSource>,
|
||||||
|
duration: Long? = null,
|
||||||
|
width: Int? = null,
|
||||||
|
height: Int? = null,
|
||||||
|
disableNotification: Boolean = false,
|
||||||
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
|
replyMarkup: KeyboardMarkup? = null
|
||||||
|
): Request<ContentMessage<AnimationContent>> {
|
||||||
|
val animationAsFileId = (animation as? FileId) ?.fileId
|
||||||
|
val animationAsFile = animation as? MultipartFile
|
||||||
|
val thumbAsFileId = (thumb as? FileId) ?.fileId
|
||||||
|
val thumbAsFile = thumb as? MultipartFile
|
||||||
|
|
||||||
|
val data = SendAnimationData(
|
||||||
|
chatId,
|
||||||
|
animationAsFileId,
|
||||||
|
thumbAsFileId,
|
||||||
|
entities.makeString(),
|
||||||
|
null,
|
||||||
|
entities.toRawMessageEntities(),
|
||||||
duration,
|
duration,
|
||||||
width,
|
width,
|
||||||
height,
|
height,
|
||||||
@ -71,6 +118,8 @@ data class SendAnimationData internal constructor(
|
|||||||
override val text: String? = null,
|
override val text: String? = null,
|
||||||
@SerialName(parseModeField)
|
@SerialName(parseModeField)
|
||||||
override val parseMode: ParseMode? = null,
|
override val parseMode: ParseMode? = null,
|
||||||
|
@SerialName(captionEntitiesField)
|
||||||
|
private val rawEntities: List<RawMessageEntity>? = null,
|
||||||
@SerialName(durationField)
|
@SerialName(durationField)
|
||||||
override val duration: Long? = null,
|
override val duration: Long? = null,
|
||||||
@SerialName(widthField)
|
@SerialName(widthField)
|
||||||
@ -91,6 +140,10 @@ data class SendAnimationData internal constructor(
|
|||||||
DuratedSendMessageRequest<ContentMessage<AnimationContent>>,
|
DuratedSendMessageRequest<ContentMessage<AnimationContent>>,
|
||||||
SizedSendMessageRequest<ContentMessage<AnimationContent>>
|
SizedSendMessageRequest<ContentMessage<AnimationContent>>
|
||||||
{
|
{
|
||||||
|
override val entities: List<TextSource>? by lazy {
|
||||||
|
rawEntities ?.asTextParts(text ?: return@lazy null) ?.justTextSources()
|
||||||
|
}
|
||||||
|
|
||||||
init {
|
init {
|
||||||
text ?.let {
|
text ?.let {
|
||||||
if (it.length !in captionLength) {
|
if (it.length !in captionLength) {
|
||||||
|
@ -1,10 +1,13 @@
|
|||||||
package dev.inmo.tgbotapi.requests.send.media
|
package dev.inmo.tgbotapi.requests.send.media
|
||||||
|
|
||||||
import dev.inmo.tgbotapi.CommonAbstracts.Performerable
|
import dev.inmo.tgbotapi.CommonAbstracts.*
|
||||||
import dev.inmo.tgbotapi.requests.abstracts.*
|
import dev.inmo.tgbotapi.requests.abstracts.*
|
||||||
import dev.inmo.tgbotapi.requests.send.abstracts.*
|
import dev.inmo.tgbotapi.requests.send.abstracts.*
|
||||||
import dev.inmo.tgbotapi.requests.send.media.base.*
|
import dev.inmo.tgbotapi.requests.send.media.base.*
|
||||||
import dev.inmo.tgbotapi.types.*
|
import dev.inmo.tgbotapi.types.*
|
||||||
|
import dev.inmo.tgbotapi.types.MessageEntity.*
|
||||||
|
import dev.inmo.tgbotapi.types.MessageEntity.RawMessageEntity
|
||||||
|
import dev.inmo.tgbotapi.types.MessageEntity.toRawMessageEntities
|
||||||
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
||||||
import dev.inmo.tgbotapi.types.ParseMode.parseModeField
|
import dev.inmo.tgbotapi.types.ParseMode.parseModeField
|
||||||
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
|
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
|
||||||
@ -39,6 +42,49 @@ fun SendAudio(
|
|||||||
thumbAsFileId,
|
thumbAsFileId,
|
||||||
caption,
|
caption,
|
||||||
parseMode,
|
parseMode,
|
||||||
|
null,
|
||||||
|
duration,
|
||||||
|
performer,
|
||||||
|
title,
|
||||||
|
disableNotification,
|
||||||
|
replyToMessageId,
|
||||||
|
replyMarkup
|
||||||
|
)
|
||||||
|
|
||||||
|
return if (audioAsFile == null && thumbAsFile == null) {
|
||||||
|
data
|
||||||
|
} else {
|
||||||
|
MultipartRequestImpl(
|
||||||
|
data,
|
||||||
|
SendAudioFiles(audioAsFile, thumbAsFile)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun SendAudio(
|
||||||
|
chatId: ChatIdentifier,
|
||||||
|
audio: InputFile,
|
||||||
|
thumb: InputFile? = null,
|
||||||
|
entities: List<TextSource>,
|
||||||
|
duration: Long? = null,
|
||||||
|
performer: String? = null,
|
||||||
|
title: String? = null,
|
||||||
|
disableNotification: Boolean = false,
|
||||||
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
|
replyMarkup: KeyboardMarkup? = null
|
||||||
|
): Request<ContentMessage<AudioContent>> {
|
||||||
|
val audioAsFileId = (audio as? FileId) ?.fileId
|
||||||
|
val audioAsFile = audio as? MultipartFile
|
||||||
|
val thumbAsFileId = (thumb as? FileId) ?.fileId
|
||||||
|
val thumbAsFile = thumb as? MultipartFile
|
||||||
|
|
||||||
|
val data = SendAudioData(
|
||||||
|
chatId,
|
||||||
|
audioAsFileId,
|
||||||
|
thumbAsFileId,
|
||||||
|
entities.makeString(),
|
||||||
|
null,
|
||||||
|
entities.toRawMessageEntities(),
|
||||||
duration,
|
duration,
|
||||||
performer,
|
performer,
|
||||||
title,
|
title,
|
||||||
@ -72,6 +118,8 @@ data class SendAudioData internal constructor(
|
|||||||
override val text: String? = null,
|
override val text: String? = null,
|
||||||
@SerialName(parseModeField)
|
@SerialName(parseModeField)
|
||||||
override val parseMode: ParseMode? = null,
|
override val parseMode: ParseMode? = null,
|
||||||
|
@SerialName(captionEntitiesField)
|
||||||
|
private val rawEntities: List<RawMessageEntity>? = null,
|
||||||
@SerialName(durationField)
|
@SerialName(durationField)
|
||||||
override val duration: Long? = null,
|
override val duration: Long? = null,
|
||||||
@SerialName(performerField)
|
@SerialName(performerField)
|
||||||
@ -93,6 +141,10 @@ data class SendAudioData internal constructor(
|
|||||||
DuratedSendMessageRequest<ContentMessage<AudioContent>>,
|
DuratedSendMessageRequest<ContentMessage<AudioContent>>,
|
||||||
Performerable
|
Performerable
|
||||||
{
|
{
|
||||||
|
override val entities: List<TextSource>? by lazy {
|
||||||
|
rawEntities ?.asTextParts(text ?: return@lazy null) ?.justTextSources()
|
||||||
|
}
|
||||||
|
|
||||||
init {
|
init {
|
||||||
text ?.let {
|
text ?.let {
|
||||||
if (it.length !in captionLength) {
|
if (it.length !in captionLength) {
|
||||||
|
@ -1,9 +1,13 @@
|
|||||||
package dev.inmo.tgbotapi.requests.send.media
|
package dev.inmo.tgbotapi.requests.send.media
|
||||||
|
|
||||||
|
import dev.inmo.tgbotapi.CommonAbstracts.*
|
||||||
import dev.inmo.tgbotapi.requests.abstracts.*
|
import dev.inmo.tgbotapi.requests.abstracts.*
|
||||||
import dev.inmo.tgbotapi.requests.send.abstracts.*
|
import dev.inmo.tgbotapi.requests.send.abstracts.*
|
||||||
import dev.inmo.tgbotapi.requests.send.media.base.*
|
import dev.inmo.tgbotapi.requests.send.media.base.*
|
||||||
import dev.inmo.tgbotapi.types.*
|
import dev.inmo.tgbotapi.types.*
|
||||||
|
import dev.inmo.tgbotapi.types.MessageEntity.*
|
||||||
|
import dev.inmo.tgbotapi.types.MessageEntity.RawMessageEntity
|
||||||
|
import dev.inmo.tgbotapi.types.MessageEntity.asTextParts
|
||||||
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
||||||
import dev.inmo.tgbotapi.types.ParseMode.parseModeField
|
import dev.inmo.tgbotapi.types.ParseMode.parseModeField
|
||||||
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
|
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
|
||||||
@ -45,6 +49,54 @@ fun SendDocument(
|
|||||||
thumbAsFileId,
|
thumbAsFileId,
|
||||||
caption,
|
caption,
|
||||||
parseMode,
|
parseMode,
|
||||||
|
null,
|
||||||
|
disableNotification,
|
||||||
|
replyToMessageId,
|
||||||
|
replyMarkup,
|
||||||
|
disableContentTypeDetection
|
||||||
|
)
|
||||||
|
|
||||||
|
return if (documentAsFile == null && thumbAsFile == null) {
|
||||||
|
data
|
||||||
|
} else {
|
||||||
|
MultipartRequestImpl(
|
||||||
|
data,
|
||||||
|
SendDocumentFiles(documentAsFile, thumbAsFile)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Use this method to send general files. On success, the sent [ContentMessage] with [DocumentContent] is returned.
|
||||||
|
* Bots can currently send files of any type of up to 50 MB in size, this limit may be changed in the future.
|
||||||
|
*
|
||||||
|
* @param disableContentTypeDetection Disables automatic server-side content type detection for [document] [MultipartFile]
|
||||||
|
*
|
||||||
|
* @see ContentMessage
|
||||||
|
* @see DocumentContent
|
||||||
|
*/
|
||||||
|
fun SendDocument(
|
||||||
|
chatId: ChatIdentifier,
|
||||||
|
document: InputFile,
|
||||||
|
thumb: InputFile? = null,
|
||||||
|
entities: List<TextSource>,
|
||||||
|
disableNotification: Boolean = false,
|
||||||
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
|
replyMarkup: KeyboardMarkup? = null,
|
||||||
|
disableContentTypeDetection: Boolean? = null
|
||||||
|
): Request<ContentMessage<DocumentContent>> {
|
||||||
|
val documentAsFileId = (document as? FileId) ?.fileId
|
||||||
|
val documentAsFile = document as? MultipartFile
|
||||||
|
val thumbAsFileId = (thumb as? FileId) ?.fileId
|
||||||
|
val thumbAsFile = thumb as? MultipartFile
|
||||||
|
|
||||||
|
val data = SendDocumentData(
|
||||||
|
chatId,
|
||||||
|
documentAsFileId,
|
||||||
|
thumbAsFileId,
|
||||||
|
entities.makeString(),
|
||||||
|
null,
|
||||||
|
entities.toRawMessageEntities(),
|
||||||
disableNotification,
|
disableNotification,
|
||||||
replyToMessageId,
|
replyToMessageId,
|
||||||
replyMarkup,
|
replyMarkup,
|
||||||
@ -85,6 +137,8 @@ data class SendDocumentData internal constructor(
|
|||||||
override val text: String? = null,
|
override val text: String? = null,
|
||||||
@SerialName(parseModeField)
|
@SerialName(parseModeField)
|
||||||
override val parseMode: ParseMode? = null,
|
override val parseMode: ParseMode? = null,
|
||||||
|
@SerialName(captionEntitiesField)
|
||||||
|
private val rawEntities: List<RawMessageEntity>? = null,
|
||||||
@SerialName(disableNotificationField)
|
@SerialName(disableNotificationField)
|
||||||
override val disableNotification: Boolean = false,
|
override val disableNotification: Boolean = false,
|
||||||
@SerialName(replyToMessageIdField)
|
@SerialName(replyToMessageIdField)
|
||||||
@ -99,6 +153,10 @@ data class SendDocumentData internal constructor(
|
|||||||
TextableSendMessageRequest<ContentMessage<DocumentContent>>,
|
TextableSendMessageRequest<ContentMessage<DocumentContent>>,
|
||||||
ThumbedSendMessageRequest<ContentMessage<DocumentContent>>
|
ThumbedSendMessageRequest<ContentMessage<DocumentContent>>
|
||||||
{
|
{
|
||||||
|
override val entities: List<TextSource>? by lazy {
|
||||||
|
rawEntities ?.asTextParts(text ?: return@lazy null) ?.justTextSources()
|
||||||
|
}
|
||||||
|
|
||||||
init {
|
init {
|
||||||
text ?.let {
|
text ?.let {
|
||||||
if (it.length !in captionLength) {
|
if (it.length !in captionLength) {
|
||||||
|
@ -1,9 +1,13 @@
|
|||||||
package dev.inmo.tgbotapi.requests.send.media
|
package dev.inmo.tgbotapi.requests.send.media
|
||||||
|
|
||||||
|
import dev.inmo.tgbotapi.CommonAbstracts.*
|
||||||
import dev.inmo.tgbotapi.requests.abstracts.*
|
import dev.inmo.tgbotapi.requests.abstracts.*
|
||||||
import dev.inmo.tgbotapi.requests.send.abstracts.*
|
import dev.inmo.tgbotapi.requests.send.abstracts.*
|
||||||
import dev.inmo.tgbotapi.requests.send.media.base.*
|
import dev.inmo.tgbotapi.requests.send.media.base.*
|
||||||
import dev.inmo.tgbotapi.types.*
|
import dev.inmo.tgbotapi.types.*
|
||||||
|
import dev.inmo.tgbotapi.types.MessageEntity.*
|
||||||
|
import dev.inmo.tgbotapi.types.MessageEntity.RawMessageEntity
|
||||||
|
import dev.inmo.tgbotapi.types.MessageEntity.toRawMessageEntities
|
||||||
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
||||||
import dev.inmo.tgbotapi.types.ParseMode.parseModeField
|
import dev.inmo.tgbotapi.types.ParseMode.parseModeField
|
||||||
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
|
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
|
||||||
@ -27,6 +31,33 @@ fun SendPhoto(
|
|||||||
(photo as? FileId) ?.fileId,
|
(photo as? FileId) ?.fileId,
|
||||||
caption,
|
caption,
|
||||||
parseMode,
|
parseMode,
|
||||||
|
null,
|
||||||
|
disableNotification,
|
||||||
|
replyToMessageId,
|
||||||
|
replyMarkup
|
||||||
|
)
|
||||||
|
return data.photo ?.let {
|
||||||
|
data
|
||||||
|
} ?: MultipartRequestImpl(
|
||||||
|
data,
|
||||||
|
SendPhotoFiles(photo as MultipartFile)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun SendPhoto(
|
||||||
|
chatId: ChatIdentifier,
|
||||||
|
photo: InputFile,
|
||||||
|
entities: List<TextSource>,
|
||||||
|
disableNotification: Boolean = false,
|
||||||
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
|
replyMarkup: KeyboardMarkup? = null
|
||||||
|
): Request<ContentMessage<PhotoContent>> {
|
||||||
|
val data = SendPhotoData(
|
||||||
|
chatId,
|
||||||
|
(photo as? FileId) ?.fileId,
|
||||||
|
entities.makeString(),
|
||||||
|
null,
|
||||||
|
entities.toRawMessageEntities(),
|
||||||
disableNotification,
|
disableNotification,
|
||||||
replyToMessageId,
|
replyToMessageId,
|
||||||
replyMarkup
|
replyMarkup
|
||||||
@ -52,6 +83,8 @@ data class SendPhotoData internal constructor(
|
|||||||
override val text: String? = null,
|
override val text: String? = null,
|
||||||
@SerialName(parseModeField)
|
@SerialName(parseModeField)
|
||||||
override val parseMode: ParseMode? = null,
|
override val parseMode: ParseMode? = null,
|
||||||
|
@SerialName(captionEntitiesField)
|
||||||
|
private val rawEntities: List<RawMessageEntity>? = null,
|
||||||
@SerialName(disableNotificationField)
|
@SerialName(disableNotificationField)
|
||||||
override val disableNotification: Boolean = false,
|
override val disableNotification: Boolean = false,
|
||||||
@SerialName(replyToMessageIdField)
|
@SerialName(replyToMessageIdField)
|
||||||
@ -63,6 +96,10 @@ data class SendPhotoData internal constructor(
|
|||||||
ReplyingMarkupSendMessageRequest<ContentMessage<PhotoContent>>,
|
ReplyingMarkupSendMessageRequest<ContentMessage<PhotoContent>>,
|
||||||
TextableSendMessageRequest<ContentMessage<PhotoContent>>
|
TextableSendMessageRequest<ContentMessage<PhotoContent>>
|
||||||
{
|
{
|
||||||
|
override val entities: List<TextSource>? by lazy {
|
||||||
|
rawEntities ?.asTextParts(text ?: return@lazy null) ?.justTextSources()
|
||||||
|
}
|
||||||
|
|
||||||
init {
|
init {
|
||||||
text ?.let {
|
text ?.let {
|
||||||
if (it.length !in captionLength) {
|
if (it.length !in captionLength) {
|
||||||
|
@ -1,9 +1,13 @@
|
|||||||
package dev.inmo.tgbotapi.requests.send.media
|
package dev.inmo.tgbotapi.requests.send.media
|
||||||
|
|
||||||
|
import dev.inmo.tgbotapi.CommonAbstracts.*
|
||||||
import dev.inmo.tgbotapi.requests.abstracts.*
|
import dev.inmo.tgbotapi.requests.abstracts.*
|
||||||
import dev.inmo.tgbotapi.requests.send.abstracts.*
|
import dev.inmo.tgbotapi.requests.send.abstracts.*
|
||||||
import dev.inmo.tgbotapi.requests.send.media.base.*
|
import dev.inmo.tgbotapi.requests.send.media.base.*
|
||||||
import dev.inmo.tgbotapi.types.*
|
import dev.inmo.tgbotapi.types.*
|
||||||
|
import dev.inmo.tgbotapi.types.MessageEntity.*
|
||||||
|
import dev.inmo.tgbotapi.types.MessageEntity.RawMessageEntity
|
||||||
|
import dev.inmo.tgbotapi.types.MessageEntity.toRawMessageEntities
|
||||||
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
||||||
import dev.inmo.tgbotapi.types.ParseMode.parseModeField
|
import dev.inmo.tgbotapi.types.ParseMode.parseModeField
|
||||||
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
|
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
|
||||||
@ -39,6 +43,51 @@ fun SendVideo(
|
|||||||
thumbAsFileId,
|
thumbAsFileId,
|
||||||
caption,
|
caption,
|
||||||
parseMode,
|
parseMode,
|
||||||
|
null,
|
||||||
|
duration,
|
||||||
|
width,
|
||||||
|
height,
|
||||||
|
supportStreaming,
|
||||||
|
disableNotification,
|
||||||
|
replyToMessageId,
|
||||||
|
replyMarkup
|
||||||
|
)
|
||||||
|
|
||||||
|
return if (videoAsFile == null && thumbAsFile == null) {
|
||||||
|
data
|
||||||
|
} else {
|
||||||
|
MultipartRequestImpl(
|
||||||
|
data,
|
||||||
|
SendVideoFiles(videoAsFile, thumbAsFile)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun SendVideo(
|
||||||
|
chatId: ChatIdentifier,
|
||||||
|
video: InputFile,
|
||||||
|
thumb: InputFile? = null,
|
||||||
|
entities: List<TextSource>,
|
||||||
|
duration: Long? = null,
|
||||||
|
width: Int? = null,
|
||||||
|
height: Int? = null,
|
||||||
|
supportStreaming: Boolean? = null,
|
||||||
|
disableNotification: Boolean = false,
|
||||||
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
|
replyMarkup: KeyboardMarkup? = null
|
||||||
|
): Request<ContentMessage<VideoContent>> {
|
||||||
|
val videoAsFileId = (video as? FileId) ?.fileId
|
||||||
|
val videoAsFile = video as? MultipartFile
|
||||||
|
val thumbAsFileId = (thumb as? FileId) ?.fileId
|
||||||
|
val thumbAsFile = thumb as? MultipartFile
|
||||||
|
|
||||||
|
val data = SendVideoData(
|
||||||
|
chatId,
|
||||||
|
videoAsFileId,
|
||||||
|
thumbAsFileId,
|
||||||
|
entities.makeString(),
|
||||||
|
null,
|
||||||
|
entities.toRawMessageEntities(),
|
||||||
duration,
|
duration,
|
||||||
width,
|
width,
|
||||||
height,
|
height,
|
||||||
@ -73,6 +122,8 @@ data class SendVideoData internal constructor(
|
|||||||
override val text: String? = null,
|
override val text: String? = null,
|
||||||
@SerialName(parseModeField)
|
@SerialName(parseModeField)
|
||||||
override val parseMode: ParseMode? = null,
|
override val parseMode: ParseMode? = null,
|
||||||
|
@SerialName(captionEntitiesField)
|
||||||
|
private val rawEntities: List<RawMessageEntity>? = null,
|
||||||
@SerialName(durationField)
|
@SerialName(durationField)
|
||||||
override val duration: Long? = null,
|
override val duration: Long? = null,
|
||||||
@SerialName(widthField)
|
@SerialName(widthField)
|
||||||
@ -95,6 +146,10 @@ data class SendVideoData internal constructor(
|
|||||||
DuratedSendMessageRequest<ContentMessage<VideoContent>>,
|
DuratedSendMessageRequest<ContentMessage<VideoContent>>,
|
||||||
SizedSendMessageRequest<ContentMessage<VideoContent>>
|
SizedSendMessageRequest<ContentMessage<VideoContent>>
|
||||||
{
|
{
|
||||||
|
override val entities: List<TextSource>? by lazy {
|
||||||
|
rawEntities ?.asTextParts(text ?: return@lazy null) ?.justTextSources()
|
||||||
|
}
|
||||||
|
|
||||||
init {
|
init {
|
||||||
text ?.let {
|
text ?.let {
|
||||||
if (it.length !in captionLength) {
|
if (it.length !in captionLength) {
|
||||||
|
@ -18,8 +18,6 @@ fun SendVideoNote(
|
|||||||
chatId: ChatIdentifier,
|
chatId: ChatIdentifier,
|
||||||
videoNote: InputFile,
|
videoNote: InputFile,
|
||||||
thumb: InputFile? = null,
|
thumb: InputFile? = null,
|
||||||
caption: String? = null,
|
|
||||||
parseMode: ParseMode? = null,
|
|
||||||
duration: Long? = null,
|
duration: Long? = null,
|
||||||
size: Int? = null, // in documentation - length (size of video side)
|
size: Int? = null, // in documentation - length (size of video side)
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
@ -35,8 +33,6 @@ fun SendVideoNote(
|
|||||||
chatId,
|
chatId,
|
||||||
videoNoteAsFileId,
|
videoNoteAsFileId,
|
||||||
thumbAsFileId,
|
thumbAsFileId,
|
||||||
caption,
|
|
||||||
parseMode,
|
|
||||||
duration,
|
duration,
|
||||||
size,
|
size,
|
||||||
disableNotification,
|
disableNotification,
|
||||||
@ -65,10 +61,6 @@ data class SendVideoNoteData internal constructor(
|
|||||||
val videoNote: String? = null,
|
val videoNote: String? = null,
|
||||||
@SerialName(thumbField)
|
@SerialName(thumbField)
|
||||||
override val thumb: String? = null,
|
override val thumb: String? = null,
|
||||||
@SerialName(captionField)
|
|
||||||
override val text: String? = null,
|
|
||||||
@SerialName(parseModeField)
|
|
||||||
override val parseMode: ParseMode? = null,
|
|
||||||
@SerialName(durationField)
|
@SerialName(durationField)
|
||||||
override val duration: Long? = null,
|
override val duration: Long? = null,
|
||||||
@SerialName(lengthField)
|
@SerialName(lengthField)
|
||||||
@ -82,7 +74,6 @@ data class SendVideoNoteData internal constructor(
|
|||||||
) : DataRequest<ContentMessage<VideoNoteContent>>,
|
) : DataRequest<ContentMessage<VideoNoteContent>>,
|
||||||
SendMessageRequest<ContentMessage<VideoNoteContent>>,
|
SendMessageRequest<ContentMessage<VideoNoteContent>>,
|
||||||
ReplyingMarkupSendMessageRequest<ContentMessage<VideoNoteContent>>,
|
ReplyingMarkupSendMessageRequest<ContentMessage<VideoNoteContent>>,
|
||||||
TextableSendMessageRequest<ContentMessage<VideoNoteContent>>,
|
|
||||||
ThumbedSendMessageRequest<ContentMessage<VideoNoteContent>>,
|
ThumbedSendMessageRequest<ContentMessage<VideoNoteContent>>,
|
||||||
DuratedSendMessageRequest<ContentMessage<VideoNoteContent>>,
|
DuratedSendMessageRequest<ContentMessage<VideoNoteContent>>,
|
||||||
SizedSendMessageRequest<ContentMessage<VideoNoteContent>>
|
SizedSendMessageRequest<ContentMessage<VideoNoteContent>>
|
||||||
@ -90,14 +81,6 @@ data class SendVideoNoteData internal constructor(
|
|||||||
override val height: Int?
|
override val height: Int?
|
||||||
get() = width
|
get() = width
|
||||||
|
|
||||||
init {
|
|
||||||
text ?.let {
|
|
||||||
if (it.length !in captionLength) {
|
|
||||||
throwRangeError("Caption length", captionLength, it.length)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun method(): String = "sendVideoNote"
|
override fun method(): String = "sendVideoNote"
|
||||||
override val resultDeserializer: DeserializationStrategy<ContentMessage<VideoNoteContent>>
|
override val resultDeserializer: DeserializationStrategy<ContentMessage<VideoNoteContent>>
|
||||||
get() = commonResultDeserializer
|
get() = commonResultDeserializer
|
||||||
|
@ -1,9 +1,13 @@
|
|||||||
package dev.inmo.tgbotapi.requests.send.media
|
package dev.inmo.tgbotapi.requests.send.media
|
||||||
|
|
||||||
|
import dev.inmo.tgbotapi.CommonAbstracts.*
|
||||||
import dev.inmo.tgbotapi.requests.abstracts.*
|
import dev.inmo.tgbotapi.requests.abstracts.*
|
||||||
import dev.inmo.tgbotapi.requests.send.abstracts.*
|
import dev.inmo.tgbotapi.requests.send.abstracts.*
|
||||||
import dev.inmo.tgbotapi.requests.send.media.base.*
|
import dev.inmo.tgbotapi.requests.send.media.base.*
|
||||||
import dev.inmo.tgbotapi.types.*
|
import dev.inmo.tgbotapi.types.*
|
||||||
|
import dev.inmo.tgbotapi.types.MessageEntity.*
|
||||||
|
import dev.inmo.tgbotapi.types.MessageEntity.RawMessageEntity
|
||||||
|
import dev.inmo.tgbotapi.types.MessageEntity.asTextParts
|
||||||
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
||||||
import dev.inmo.tgbotapi.types.ParseMode.parseModeField
|
import dev.inmo.tgbotapi.types.ParseMode.parseModeField
|
||||||
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
|
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
|
||||||
@ -32,6 +36,41 @@ fun SendVoice(
|
|||||||
voiceAsFileId,
|
voiceAsFileId,
|
||||||
caption,
|
caption,
|
||||||
parseMode,
|
parseMode,
|
||||||
|
null,
|
||||||
|
duration,
|
||||||
|
disableNotification,
|
||||||
|
replyToMessageId,
|
||||||
|
replyMarkup
|
||||||
|
)
|
||||||
|
|
||||||
|
return if (voiceAsFile == null) {
|
||||||
|
data
|
||||||
|
} else {
|
||||||
|
MultipartRequestImpl(
|
||||||
|
data,
|
||||||
|
SendVoiceFiles(voiceAsFile)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun SendVoice(
|
||||||
|
chatId: ChatIdentifier,
|
||||||
|
voice: InputFile,
|
||||||
|
entities: List<TextSource>,
|
||||||
|
duration: Long? = null,
|
||||||
|
disableNotification: Boolean = false,
|
||||||
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
|
replyMarkup: KeyboardMarkup? = null
|
||||||
|
): Request<ContentMessage<VoiceContent>> {
|
||||||
|
val voiceAsFileId = (voice as? FileId) ?.fileId
|
||||||
|
val voiceAsFile = voice as? MultipartFile
|
||||||
|
|
||||||
|
val data = SendVoiceData(
|
||||||
|
chatId,
|
||||||
|
voiceAsFileId,
|
||||||
|
entities.makeString(),
|
||||||
|
null,
|
||||||
|
entities.toRawMessageEntities(),
|
||||||
duration,
|
duration,
|
||||||
disableNotification,
|
disableNotification,
|
||||||
replyToMessageId,
|
replyToMessageId,
|
||||||
@ -61,6 +100,8 @@ data class SendVoiceData internal constructor(
|
|||||||
override val text: String? = null,
|
override val text: String? = null,
|
||||||
@SerialName(parseModeField)
|
@SerialName(parseModeField)
|
||||||
override val parseMode: ParseMode? = null,
|
override val parseMode: ParseMode? = null,
|
||||||
|
@SerialName(captionEntitiesField)
|
||||||
|
private val rawEntities: List<RawMessageEntity>? = null,
|
||||||
@SerialName(durationField)
|
@SerialName(durationField)
|
||||||
override val duration: Long? = null,
|
override val duration: Long? = null,
|
||||||
@SerialName(disableNotificationField)
|
@SerialName(disableNotificationField)
|
||||||
@ -75,6 +116,10 @@ data class SendVoiceData internal constructor(
|
|||||||
TextableSendMessageRequest<ContentMessage<VoiceContent>>,
|
TextableSendMessageRequest<ContentMessage<VoiceContent>>,
|
||||||
DuratedSendMessageRequest<ContentMessage<VoiceContent>>
|
DuratedSendMessageRequest<ContentMessage<VoiceContent>>
|
||||||
{
|
{
|
||||||
|
override val entities: List<TextSource>? by lazy {
|
||||||
|
rawEntities ?.asTextParts(text ?: return@lazy null) ?.justTextSources()
|
||||||
|
}
|
||||||
|
|
||||||
init {
|
init {
|
||||||
text ?.let {
|
text ?.let {
|
||||||
if (it.length !in captionLength) {
|
if (it.length !in captionLength) {
|
||||||
|
@ -14,6 +14,9 @@ import dev.inmo.tgbotapi.types.polls.*
|
|||||||
import dev.inmo.tgbotapi.utils.fullListOfSubSource
|
import dev.inmo.tgbotapi.utils.fullListOfSubSource
|
||||||
import dev.inmo.tgbotapi.utils.toMarkdownV2Captions
|
import dev.inmo.tgbotapi.utils.toMarkdownV2Captions
|
||||||
import com.soywiz.klock.DateTime
|
import com.soywiz.klock.DateTime
|
||||||
|
import dev.inmo.tgbotapi.types.MessageEntity.*
|
||||||
|
import dev.inmo.tgbotapi.types.MessageEntity.RawMessageEntity
|
||||||
|
import dev.inmo.tgbotapi.types.MessageEntity.asTextParts
|
||||||
import kotlinx.serialization.*
|
import kotlinx.serialization.*
|
||||||
|
|
||||||
private val commonResultDeserializer: DeserializationStrategy<ContentMessage<PollContent>> = TelegramBotAPIMessageDeserializationStrategyClass()
|
private val commonResultDeserializer: DeserializationStrategy<ContentMessage<PollContent>> = TelegramBotAPIMessageDeserializationStrategyClass()
|
||||||
@ -85,8 +88,7 @@ fun Poll.createRequest(
|
|||||||
correctOptionId,
|
correctOptionId,
|
||||||
isAnonymous,
|
isAnonymous,
|
||||||
isClosed,
|
isClosed,
|
||||||
explanation ?.fullListOfSubSource(explanationEntities) ?.justTextSources() ?.toMarkdownV2Captions() ?.firstOrNull(),
|
fullEntitiesList(),
|
||||||
MarkdownV2,
|
|
||||||
scheduledCloseInfo,
|
scheduledCloseInfo,
|
||||||
disableNotification,
|
disableNotification,
|
||||||
replyToMessageId,
|
replyToMessageId,
|
||||||
@ -186,8 +188,65 @@ data class SendRegularPoll(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun SendQuizPoll(
|
||||||
|
chatId: ChatIdentifier,
|
||||||
|
question: String,
|
||||||
|
options: List<String>,
|
||||||
|
correctOptionId: Int,
|
||||||
|
isAnonymous: Boolean = true,
|
||||||
|
isClosed: Boolean = false,
|
||||||
|
explanation: String? = null,
|
||||||
|
parseMode: ParseMode? = null,
|
||||||
|
closeInfo: ScheduledCloseInfo? = null,
|
||||||
|
disableNotification: Boolean = false,
|
||||||
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
|
replyMarkup: KeyboardMarkup? = null
|
||||||
|
) = SendQuizPoll(
|
||||||
|
chatId,
|
||||||
|
question,
|
||||||
|
options,
|
||||||
|
correctOptionId,
|
||||||
|
isAnonymous,
|
||||||
|
isClosed,
|
||||||
|
explanation,
|
||||||
|
parseMode,
|
||||||
|
null,
|
||||||
|
closeInfo,
|
||||||
|
disableNotification,
|
||||||
|
replyToMessageId,
|
||||||
|
replyMarkup
|
||||||
|
)
|
||||||
|
|
||||||
|
fun SendQuizPoll(
|
||||||
|
chatId: ChatIdentifier,
|
||||||
|
question: String,
|
||||||
|
options: List<String>,
|
||||||
|
correctOptionId: Int,
|
||||||
|
isAnonymous: Boolean = true,
|
||||||
|
isClosed: Boolean = false,
|
||||||
|
entities: List<TextSource>,
|
||||||
|
closeInfo: ScheduledCloseInfo? = null,
|
||||||
|
disableNotification: Boolean = false,
|
||||||
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
|
replyMarkup: KeyboardMarkup? = null
|
||||||
|
) = SendQuizPoll(
|
||||||
|
chatId,
|
||||||
|
question,
|
||||||
|
options,
|
||||||
|
correctOptionId,
|
||||||
|
isAnonymous,
|
||||||
|
isClosed,
|
||||||
|
entities.makeString(),
|
||||||
|
null,
|
||||||
|
entities.toRawMessageEntities(),
|
||||||
|
closeInfo,
|
||||||
|
disableNotification,
|
||||||
|
replyToMessageId,
|
||||||
|
replyMarkup
|
||||||
|
)
|
||||||
|
|
||||||
@Serializable
|
@Serializable
|
||||||
data class SendQuizPoll(
|
data class SendQuizPoll internal constructor(
|
||||||
@SerialName(chatIdField)
|
@SerialName(chatIdField)
|
||||||
override val chatId: ChatIdentifier,
|
override val chatId: ChatIdentifier,
|
||||||
@SerialName(questionField)
|
@SerialName(questionField)
|
||||||
@ -204,6 +263,8 @@ data class SendQuizPoll(
|
|||||||
override val explanation: String? = null,
|
override val explanation: String? = null,
|
||||||
@SerialName(explanationParseModeField)
|
@SerialName(explanationParseModeField)
|
||||||
override val parseMode: ParseMode? = null,
|
override val parseMode: ParseMode? = null,
|
||||||
|
@SerialName(explanationEntitiesField)
|
||||||
|
private val rawEntities: List<RawMessageEntity>? = null,
|
||||||
@Transient
|
@Transient
|
||||||
override val closeInfo: ScheduledCloseInfo? = null,
|
override val closeInfo: ScheduledCloseInfo? = null,
|
||||||
@SerialName(disableNotificationField)
|
@SerialName(disableNotificationField)
|
||||||
@ -216,6 +277,9 @@ data class SendQuizPoll(
|
|||||||
override val type: String = quizPollType
|
override val type: String = quizPollType
|
||||||
override val requestSerializer: SerializationStrategy<*>
|
override val requestSerializer: SerializationStrategy<*>
|
||||||
get() = serializer()
|
get() = serializer()
|
||||||
|
override val entities: List<TextSource>? by lazy {
|
||||||
|
rawEntities ?.asTextParts(explanation ?: return@lazy null) ?.justTextSources()
|
||||||
|
}
|
||||||
|
|
||||||
@SerialName(openPeriodField)
|
@SerialName(openPeriodField)
|
||||||
override val openPeriod: LongSeconds?
|
override val openPeriod: LongSeconds?
|
||||||
|
@ -108,6 +108,7 @@ const val canJoinGroupsField = "can_join_groups"
|
|||||||
const val canReadAllGroupMessagesField = "can_read_all_group_messages"
|
const val canReadAllGroupMessagesField = "can_read_all_group_messages"
|
||||||
const val supportInlineQueriesField = "supports_inline_queries"
|
const val supportInlineQueriesField = "supports_inline_queries"
|
||||||
const val textEntitiesField = "text_entities"
|
const val textEntitiesField = "text_entities"
|
||||||
|
const val entitiesField = "entities"
|
||||||
const val stickerSetNameField = "set_name"
|
const val stickerSetNameField = "set_name"
|
||||||
const val stickerSetNameFullField = "sticker_set_name"
|
const val stickerSetNameFullField = "sticker_set_name"
|
||||||
const val slowModeDelayField = "slow_mode_delay"
|
const val slowModeDelayField = "slow_mode_delay"
|
||||||
@ -147,6 +148,7 @@ const val totalVoterCountField = "total_voter_count"
|
|||||||
const val correctOptionIdField = "correct_option_id"
|
const val correctOptionIdField = "correct_option_id"
|
||||||
const val allowsMultipleAnswersField = "allows_multiple_answers"
|
const val allowsMultipleAnswersField = "allows_multiple_answers"
|
||||||
const val isAnonymousField = "is_anonymous"
|
const val isAnonymousField = "is_anonymous"
|
||||||
|
const val captionEntitiesField = "caption_entities"
|
||||||
const val loginUrlField = "login_url"
|
const val loginUrlField = "login_url"
|
||||||
const val forwardTextField = "forward_text"
|
const val forwardTextField = "forward_text"
|
||||||
const val botUsernameField = "bot_username"
|
const val botUsernameField = "bot_username"
|
||||||
|
@ -1,25 +1,57 @@
|
|||||||
package dev.inmo.tgbotapi.types.InputMedia
|
package dev.inmo.tgbotapi.types.InputMedia
|
||||||
|
|
||||||
import dev.inmo.tgbotapi.CommonAbstracts.CaptionedOutput
|
import dev.inmo.tgbotapi.CommonAbstracts.*
|
||||||
import dev.inmo.tgbotapi.requests.abstracts.*
|
import dev.inmo.tgbotapi.requests.abstracts.*
|
||||||
|
import dev.inmo.tgbotapi.types.*
|
||||||
|
import dev.inmo.tgbotapi.types.MessageEntity.*
|
||||||
|
import dev.inmo.tgbotapi.types.MessageEntity.RawMessageEntity
|
||||||
|
import dev.inmo.tgbotapi.types.MessageEntity.asTextParts
|
||||||
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
||||||
import dev.inmo.tgbotapi.types.ParseMode.parseModeField
|
import dev.inmo.tgbotapi.types.ParseMode.parseModeField
|
||||||
import dev.inmo.tgbotapi.types.mediaField
|
|
||||||
import kotlinx.serialization.SerialName
|
import kotlinx.serialization.SerialName
|
||||||
import kotlinx.serialization.Serializable
|
import kotlinx.serialization.Serializable
|
||||||
|
|
||||||
|
fun InputMediaAnimation(
|
||||||
|
file: InputFile,
|
||||||
|
text: String? = null,
|
||||||
|
parseMode: ParseMode? = null,
|
||||||
|
width: Int? = null,
|
||||||
|
height: Int? = null,
|
||||||
|
duration: Long? = null,
|
||||||
|
thumb: InputFile? = null
|
||||||
|
) = InputMediaAnimation(file, text, parseMode, null, width, height, duration, thumb)
|
||||||
|
|
||||||
|
fun InputMediaAnimation(
|
||||||
|
file: InputFile,
|
||||||
|
entities: List<TextSource>,
|
||||||
|
width: Int? = null,
|
||||||
|
height: Int? = null,
|
||||||
|
duration: Long? = null,
|
||||||
|
thumb: InputFile? = null
|
||||||
|
) = InputMediaAnimation(file, entities.makeString(), null, entities.toRawMessageEntities(), width, height, duration, thumb)
|
||||||
|
|
||||||
@Serializable
|
@Serializable
|
||||||
data class InputMediaAnimation(
|
data class InputMediaAnimation internal constructor(
|
||||||
override val file: InputFile,
|
override val file: InputFile,
|
||||||
override val caption: String? = null,
|
@SerialName(captionField)
|
||||||
|
override val text: String? = null,
|
||||||
@SerialName(parseModeField)
|
@SerialName(parseModeField)
|
||||||
override val parseMode: ParseMode? = null,
|
override val parseMode: ParseMode? = null,
|
||||||
|
@SerialName(captionEntitiesField)
|
||||||
|
private val rawEntities: List<RawMessageEntity>? = null,
|
||||||
override val width: Int? = null,
|
override val width: Int? = null,
|
||||||
override val height: Int? = null,
|
override val height: Int? = null,
|
||||||
override val duration: Long? = null,
|
override val duration: Long? = null,
|
||||||
override val thumb: InputFile? = null
|
override val thumb: InputFile? = null
|
||||||
) : InputMedia, SizedInputMedia, DuratedInputMedia, ThumbedInputMedia, CaptionedOutput {
|
) : InputMedia, SizedInputMedia, DuratedInputMedia, ThumbedInputMedia, TextedOutput, CaptionedOutput {
|
||||||
override val type: String = "animation"
|
override val type: String = "animation"
|
||||||
|
override val entities: List<TextSource>? by lazy {
|
||||||
|
rawEntities ?.asTextParts(text ?: return@lazy null) ?.justTextSources()
|
||||||
|
}
|
||||||
|
|
||||||
|
@Deprecated("Will be removed in next major release")
|
||||||
|
override val caption: String?
|
||||||
|
get() = text
|
||||||
|
|
||||||
@SerialName(mediaField)
|
@SerialName(mediaField)
|
||||||
override val media: String
|
override val media: String
|
||||||
|
@ -1,30 +1,61 @@
|
|||||||
package dev.inmo.tgbotapi.types.InputMedia
|
package dev.inmo.tgbotapi.types.InputMedia
|
||||||
|
|
||||||
import dev.inmo.tgbotapi.CommonAbstracts.CaptionedOutput
|
import dev.inmo.tgbotapi.CommonAbstracts.*
|
||||||
import dev.inmo.tgbotapi.CommonAbstracts.Performerable
|
|
||||||
import dev.inmo.tgbotapi.requests.abstracts.*
|
import dev.inmo.tgbotapi.requests.abstracts.*
|
||||||
|
import dev.inmo.tgbotapi.types.*
|
||||||
|
import dev.inmo.tgbotapi.types.MessageEntity.*
|
||||||
|
import dev.inmo.tgbotapi.types.MessageEntity.RawMessageEntity
|
||||||
|
import dev.inmo.tgbotapi.types.MessageEntity.asTextParts
|
||||||
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
||||||
import dev.inmo.tgbotapi.types.ParseMode.parseModeField
|
import dev.inmo.tgbotapi.types.ParseMode.parseModeField
|
||||||
import dev.inmo.tgbotapi.types.files.AudioFile
|
import dev.inmo.tgbotapi.types.files.AudioFile
|
||||||
import dev.inmo.tgbotapi.types.files.PhotoSize
|
import dev.inmo.tgbotapi.types.files.PhotoSize
|
||||||
import dev.inmo.tgbotapi.types.mediaField
|
|
||||||
import dev.inmo.tgbotapi.types.message.content.media.AudioContent
|
import dev.inmo.tgbotapi.types.message.content.media.AudioContent
|
||||||
import kotlinx.serialization.*
|
import kotlinx.serialization.*
|
||||||
|
|
||||||
internal const val audioInputMediaType = "audio"
|
internal const val audioInputMediaType = "audio"
|
||||||
|
|
||||||
|
fun InputMediaAudio(
|
||||||
|
file: InputFile,
|
||||||
|
entities: List<TextSource>,
|
||||||
|
duration: Long? = null,
|
||||||
|
performer: String? = null,
|
||||||
|
title: String? = null,
|
||||||
|
thumb: InputFile? = null
|
||||||
|
) = InputMediaAudio(
|
||||||
|
file, entities.makeString(), null, entities.toRawMessageEntities(), duration, performer, title, thumb
|
||||||
|
)
|
||||||
|
|
||||||
|
fun InputMediaAudio(
|
||||||
|
file: InputFile,
|
||||||
|
text: String? = null,
|
||||||
|
parseMode: ParseMode? = null,
|
||||||
|
duration: Long? = null,
|
||||||
|
performer: String? = null,
|
||||||
|
title: String? = null,
|
||||||
|
thumb: InputFile? = null
|
||||||
|
) = InputMediaAudio(
|
||||||
|
file, text, parseMode, null, duration, performer, title, thumb
|
||||||
|
)
|
||||||
|
|
||||||
@Serializable
|
@Serializable
|
||||||
data class InputMediaAudio(
|
data class InputMediaAudio internal constructor(
|
||||||
override val file: InputFile,
|
override val file: InputFile,
|
||||||
override val caption: String? = null,
|
@SerialName(captionField)
|
||||||
|
override val text: String? = null,
|
||||||
@SerialName(parseModeField)
|
@SerialName(parseModeField)
|
||||||
override val parseMode: ParseMode? = null,
|
override val parseMode: ParseMode? = null,
|
||||||
|
@SerialName(captionEntitiesField)
|
||||||
|
private val rawEntities: List<RawMessageEntity>? = null,
|
||||||
override val duration: Long? = null,
|
override val duration: Long? = null,
|
||||||
override val performer: String? = null,
|
override val performer: String? = null,
|
||||||
override val title: String? = null,
|
override val title: String? = null,
|
||||||
override val thumb: InputFile? = null
|
override val thumb: InputFile? = null
|
||||||
) : InputMedia, AudioMediaGroupMemberInputMedia, DuratedInputMedia, ThumbedInputMedia, TitledInputMedia, CaptionedOutput, Performerable {
|
) : InputMedia, AudioMediaGroupMemberInputMedia, DuratedInputMedia, ThumbedInputMedia, TitledInputMedia, Performerable {
|
||||||
override val type: String = audioInputMediaType
|
override val type: String = audioInputMediaType
|
||||||
|
override val entities: List<TextSource>? by lazy {
|
||||||
|
rawEntities ?.asTextParts(text ?: return@lazy null) ?.justTextSources()
|
||||||
|
}
|
||||||
|
|
||||||
override fun serialize(format: StringFormat): String = format.encodeToString(serializer(), this)
|
override fun serialize(format: StringFormat): String = format.encodeToString(serializer(), this)
|
||||||
|
|
||||||
|
@ -1,16 +1,33 @@
|
|||||||
package dev.inmo.tgbotapi.types.InputMedia
|
package dev.inmo.tgbotapi.types.InputMedia
|
||||||
|
|
||||||
import dev.inmo.tgbotapi.CommonAbstracts.CaptionedOutput
|
import dev.inmo.tgbotapi.CommonAbstracts.*
|
||||||
import dev.inmo.tgbotapi.requests.abstracts.*
|
import dev.inmo.tgbotapi.requests.abstracts.*
|
||||||
|
import dev.inmo.tgbotapi.types.*
|
||||||
|
import dev.inmo.tgbotapi.types.MessageEntity.*
|
||||||
|
import dev.inmo.tgbotapi.types.MessageEntity.RawMessageEntity
|
||||||
|
import dev.inmo.tgbotapi.types.MessageEntity.asTextParts
|
||||||
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
||||||
import dev.inmo.tgbotapi.types.ParseMode.parseModeField
|
import dev.inmo.tgbotapi.types.ParseMode.parseModeField
|
||||||
import dev.inmo.tgbotapi.types.disableContentTypeDetectionField
|
|
||||||
import dev.inmo.tgbotapi.types.files.DocumentFile
|
import dev.inmo.tgbotapi.types.files.DocumentFile
|
||||||
import dev.inmo.tgbotapi.types.mediaField
|
|
||||||
import kotlinx.serialization.*
|
import kotlinx.serialization.*
|
||||||
|
|
||||||
internal const val documentInputMediaType = "document"
|
internal const val documentInputMediaType = "document"
|
||||||
|
|
||||||
|
fun InputMediaDocument(
|
||||||
|
file: InputFile,
|
||||||
|
caption: String? = null,
|
||||||
|
parseMode: ParseMode? = null,
|
||||||
|
thumb: InputFile? = null,
|
||||||
|
disableContentTypeDetection: Boolean? = null
|
||||||
|
) = InputMediaDocument(file, caption, parseMode, null, thumb, disableContentTypeDetection)
|
||||||
|
|
||||||
|
fun InputMediaDocument(
|
||||||
|
file: InputFile,
|
||||||
|
entities: List<TextSource>,
|
||||||
|
thumb: InputFile? = null,
|
||||||
|
disableContentTypeDetection: Boolean? = null
|
||||||
|
) = InputMediaDocument(file, entities.makeString(), null, entities.toRawMessageEntities(), thumb, disableContentTypeDetection)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents a general file to be sent. See https://core.telegram.org/bots/api#inputmediadocument
|
* Represents a general file to be sent. See https://core.telegram.org/bots/api#inputmediadocument
|
||||||
*
|
*
|
||||||
@ -22,16 +39,22 @@ internal const val documentInputMediaType = "document"
|
|||||||
* @see FileId
|
* @see FileId
|
||||||
*/
|
*/
|
||||||
@Serializable
|
@Serializable
|
||||||
data class InputMediaDocument(
|
data class InputMediaDocument internal constructor(
|
||||||
override val file: InputFile,
|
override val file: InputFile,
|
||||||
override val caption: String? = null,
|
@SerialName(captionField)
|
||||||
|
override val text: String? = null,
|
||||||
@SerialName(parseModeField)
|
@SerialName(parseModeField)
|
||||||
override val parseMode: ParseMode? = null,
|
override val parseMode: ParseMode? = null,
|
||||||
|
@SerialName(captionEntitiesField)
|
||||||
|
private val rawEntities: List<RawMessageEntity>? = null,
|
||||||
override val thumb: InputFile? = null,
|
override val thumb: InputFile? = null,
|
||||||
@SerialName(disableContentTypeDetectionField)
|
@SerialName(disableContentTypeDetectionField)
|
||||||
val disableContentTypeDetection: Boolean? = null
|
val disableContentTypeDetection: Boolean? = null
|
||||||
) : InputMedia, DocumentMediaGroupMemberInputMedia, ThumbedInputMedia, CaptionedOutput {
|
) : InputMedia, DocumentMediaGroupMemberInputMedia, ThumbedInputMedia {
|
||||||
override val type: String = documentInputMediaType
|
override val type: String = documentInputMediaType
|
||||||
|
override val entities: List<TextSource>? by lazy {
|
||||||
|
rawEntities ?.asTextParts(text ?: return@lazy null) ?.justTextSources()
|
||||||
|
}
|
||||||
|
|
||||||
override fun serialize(format: StringFormat): String = format.encodeToString(serializer(), this)
|
override fun serialize(format: StringFormat): String = format.encodeToString(serializer(), this)
|
||||||
|
|
||||||
|
@ -1,24 +1,45 @@
|
|||||||
package dev.inmo.tgbotapi.types.InputMedia
|
package dev.inmo.tgbotapi.types.InputMedia
|
||||||
|
|
||||||
|
import dev.inmo.tgbotapi.CommonAbstracts.*
|
||||||
import dev.inmo.tgbotapi.requests.abstracts.*
|
import dev.inmo.tgbotapi.requests.abstracts.*
|
||||||
|
import dev.inmo.tgbotapi.types.*
|
||||||
|
import dev.inmo.tgbotapi.types.MessageEntity.*
|
||||||
|
import dev.inmo.tgbotapi.types.MessageEntity.RawMessageEntity
|
||||||
|
import dev.inmo.tgbotapi.types.MessageEntity.toRawMessageEntities
|
||||||
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
||||||
import dev.inmo.tgbotapi.types.ParseMode.parseModeField
|
import dev.inmo.tgbotapi.types.ParseMode.parseModeField
|
||||||
import dev.inmo.tgbotapi.types.files.PhotoSize
|
import dev.inmo.tgbotapi.types.files.PhotoSize
|
||||||
import dev.inmo.tgbotapi.types.mediaField
|
|
||||||
import kotlinx.serialization.*
|
import kotlinx.serialization.*
|
||||||
import kotlinx.serialization.json.JsonElement
|
import kotlinx.serialization.json.JsonElement
|
||||||
import kotlinx.serialization.json.JsonObject
|
import kotlinx.serialization.json.JsonObject
|
||||||
|
|
||||||
internal const val photoInputMediaType = "photo"
|
internal const val photoInputMediaType = "photo"
|
||||||
|
|
||||||
|
fun InputMediaPhoto(
|
||||||
|
file: InputFile,
|
||||||
|
text: String? = null,
|
||||||
|
parseMode: ParseMode? = null
|
||||||
|
) = InputMediaPhoto(file, text, parseMode, null)
|
||||||
|
|
||||||
|
fun InputMediaPhoto(
|
||||||
|
file: InputFile,
|
||||||
|
entities: List<TextSource>
|
||||||
|
) = InputMediaPhoto(file, entities.makeString(), null, entities.toRawMessageEntities())
|
||||||
|
|
||||||
@Serializable
|
@Serializable
|
||||||
data class InputMediaPhoto(
|
data class InputMediaPhoto internal constructor(
|
||||||
override val file: InputFile,
|
override val file: InputFile,
|
||||||
override val caption: String? = null,
|
@SerialName(captionField)
|
||||||
|
override val text: String? = null,
|
||||||
@SerialName(parseModeField)
|
@SerialName(parseModeField)
|
||||||
override val parseMode: ParseMode? = null
|
override val parseMode: ParseMode? = null,
|
||||||
|
@SerialName(captionEntitiesField)
|
||||||
|
private val rawEntities: List<RawMessageEntity>? = null
|
||||||
) : InputMedia, VisualMediaGroupMemberInputMedia {
|
) : InputMedia, VisualMediaGroupMemberInputMedia {
|
||||||
override val type: String = photoInputMediaType
|
override val type: String = photoInputMediaType
|
||||||
|
override val entities: List<TextSource>? by lazy {
|
||||||
|
rawEntities ?.asTextParts(text ?: return@lazy null) ?.justTextSources()
|
||||||
|
}
|
||||||
|
|
||||||
override fun serialize(format: StringFormat): String = format.encodeToString(serializer(), this)
|
override fun serialize(format: StringFormat): String = format.encodeToString(serializer(), this)
|
||||||
|
|
||||||
|
@ -1,26 +1,55 @@
|
|||||||
package dev.inmo.tgbotapi.types.InputMedia
|
package dev.inmo.tgbotapi.types.InputMedia
|
||||||
|
|
||||||
|
import dev.inmo.tgbotapi.CommonAbstracts.*
|
||||||
import dev.inmo.tgbotapi.requests.abstracts.*
|
import dev.inmo.tgbotapi.requests.abstracts.*
|
||||||
|
import dev.inmo.tgbotapi.types.*
|
||||||
|
import dev.inmo.tgbotapi.types.MessageEntity.*
|
||||||
|
import dev.inmo.tgbotapi.types.MessageEntity.RawMessageEntity
|
||||||
|
import dev.inmo.tgbotapi.types.MessageEntity.toRawMessageEntities
|
||||||
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
||||||
import dev.inmo.tgbotapi.types.ParseMode.parseModeField
|
import dev.inmo.tgbotapi.types.ParseMode.parseModeField
|
||||||
import dev.inmo.tgbotapi.types.mediaField
|
|
||||||
import kotlinx.serialization.*
|
import kotlinx.serialization.*
|
||||||
import kotlinx.serialization.json.JsonElement
|
import kotlinx.serialization.json.JsonElement
|
||||||
|
|
||||||
internal const val videoInputMediaType = "video"
|
internal const val videoInputMediaType = "video"
|
||||||
|
|
||||||
|
fun InputMediaVideo(
|
||||||
|
file: InputFile,
|
||||||
|
text: String? = null,
|
||||||
|
parseMode: ParseMode? = null,
|
||||||
|
width: Int? = null,
|
||||||
|
height: Int? = null,
|
||||||
|
duration: Long? = null,
|
||||||
|
thumb: InputFile? = null
|
||||||
|
) = InputMediaVideo(file, text, parseMode, null, width, height, duration, thumb)
|
||||||
|
|
||||||
|
fun InputMediaVideo(
|
||||||
|
file: InputFile,
|
||||||
|
entities: List<TextSource>,
|
||||||
|
width: Int? = null,
|
||||||
|
height: Int? = null,
|
||||||
|
duration: Long? = null,
|
||||||
|
thumb: InputFile? = null
|
||||||
|
) = InputMediaVideo(file, entities.makeString(), null, entities.toRawMessageEntities(), width, height, duration, thumb)
|
||||||
|
|
||||||
@Serializable
|
@Serializable
|
||||||
data class InputMediaVideo(
|
data class InputMediaVideo internal constructor (
|
||||||
override val file: InputFile,
|
override val file: InputFile,
|
||||||
override val caption: String? = null,
|
@SerialName(captionField)
|
||||||
|
override val text: String? = null,
|
||||||
@SerialName(parseModeField)
|
@SerialName(parseModeField)
|
||||||
override val parseMode: ParseMode? = null,
|
override val parseMode: ParseMode? = null,
|
||||||
|
@SerialName(captionEntitiesField)
|
||||||
|
private val rawEntities: List<RawMessageEntity>? = null,
|
||||||
override val width: Int? = null,
|
override val width: Int? = null,
|
||||||
override val height: Int? = null,
|
override val height: Int? = null,
|
||||||
override val duration: Long? = null,
|
override val duration: Long? = null,
|
||||||
override val thumb: InputFile? = null
|
override val thumb: InputFile? = null
|
||||||
) : InputMedia, SizedInputMedia, DuratedInputMedia, ThumbedInputMedia, VisualMediaGroupMemberInputMedia {
|
) : InputMedia, SizedInputMedia, DuratedInputMedia, ThumbedInputMedia, VisualMediaGroupMemberInputMedia {
|
||||||
override val type: String = videoInputMediaType
|
override val type: String = videoInputMediaType
|
||||||
|
override val entities: List<TextSource>? by lazy {
|
||||||
|
rawEntities ?.asTextParts(text ?: return@lazy null) ?.justTextSources()
|
||||||
|
}
|
||||||
|
|
||||||
override fun serialize(format: StringFormat): String = format.encodeToString(serializer(), this)
|
override fun serialize(format: StringFormat): String = format.encodeToString(serializer(), this)
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package dev.inmo.tgbotapi.types.InputMedia
|
package dev.inmo.tgbotapi.types.InputMedia
|
||||||
|
|
||||||
import dev.inmo.tgbotapi.CommonAbstracts.CaptionedOutput
|
import dev.inmo.tgbotapi.CommonAbstracts.CaptionedOutput
|
||||||
|
import dev.inmo.tgbotapi.CommonAbstracts.TextedOutput
|
||||||
import kotlinx.serialization.*
|
import kotlinx.serialization.*
|
||||||
import kotlinx.serialization.json.*
|
import kotlinx.serialization.json.*
|
||||||
|
|
||||||
@ -15,7 +16,10 @@ internal fun <T> T.buildArguments(withSerializer: SerializationStrategy<T>) = ar
|
|||||||
)
|
)
|
||||||
|
|
||||||
@Serializable(MediaGroupMemberInputMediaSerializer::class)
|
@Serializable(MediaGroupMemberInputMediaSerializer::class)
|
||||||
interface MediaGroupMemberInputMedia : InputMedia, CaptionedOutput {
|
interface MediaGroupMemberInputMedia : InputMedia, CaptionedOutput, TextedOutput {
|
||||||
|
@Deprecated("Will be removed in next major release")
|
||||||
|
override val caption: String?
|
||||||
|
get() = text
|
||||||
fun serialize(format: StringFormat): String
|
fun serialize(format: StringFormat): String
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
package dev.inmo.tgbotapi.types.MessageEntity
|
package dev.inmo.tgbotapi.types.MessageEntity
|
||||||
|
|
||||||
import dev.inmo.tgbotapi.CommonAbstracts.MultilevelTextSource
|
import dev.inmo.tgbotapi.CommonAbstracts.*
|
||||||
import dev.inmo.tgbotapi.CommonAbstracts.TextPart
|
|
||||||
import dev.inmo.tgbotapi.types.MessageEntity.textsources.*
|
import dev.inmo.tgbotapi.types.MessageEntity.textsources.*
|
||||||
import dev.inmo.tgbotapi.types.User
|
import dev.inmo.tgbotapi.types.User
|
||||||
import dev.inmo.tgbotapi.utils.shiftSourcesToTheLeft
|
import dev.inmo.tgbotapi.utils.shiftSourcesToTheLeft
|
||||||
@ -83,7 +82,7 @@ internal fun createTextPart(from: String, entities: RawMessageEntities): List<Te
|
|||||||
return resultList
|
return resultList
|
||||||
}
|
}
|
||||||
|
|
||||||
internal fun List<TextPart>.asRawMessageEntities() = mapNotNull {
|
internal fun List<TextPart>.asRawMessageEntities(): List<RawMessageEntity> = mapNotNull {
|
||||||
val source = it.source
|
val source = it.source
|
||||||
when (source) {
|
when (source) {
|
||||||
is MentionTextSource -> RawMessageEntity("mention", it.range.first, it.range.last - it.range.first)
|
is MentionTextSource -> RawMessageEntity("mention", it.range.first, it.range.last - it.range.first)
|
||||||
@ -105,6 +104,18 @@ internal fun List<TextPart>.asRawMessageEntities() = mapNotNull {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
internal fun List<TextSource>.toRawMessageEntities(): List<RawMessageEntity> {
|
||||||
|
var i = 0
|
||||||
|
return map {
|
||||||
|
TextPart(
|
||||||
|
i until it.source.length,
|
||||||
|
it
|
||||||
|
).also {
|
||||||
|
i = it.range.last + 1
|
||||||
|
}
|
||||||
|
}.asRawMessageEntities()
|
||||||
|
}
|
||||||
|
|
||||||
internal fun RawMessageEntities.asTextParts(sourceString: String): List<TextPart> = createTextPart(sourceString, this)
|
internal fun RawMessageEntities.asTextParts(sourceString: String): List<TextPart> = createTextPart(sourceString, this)
|
||||||
|
|
||||||
internal typealias RawMessageEntities = List<RawMessageEntity>
|
internal typealias RawMessageEntities = List<RawMessageEntity>
|
||||||
|
Loading…
Reference in New Issue
Block a user