1
0
mirror of https://github.com/InsanusMokrassar/TelegramBotAPI.git synced 2024-06-01 23:45:25 +00:00
tgbotapi/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/SendMessage.kt

47 lines
1.7 KiB
Kotlin
Raw Normal View History

2018-12-26 08:07:24 +00:00
package com.github.insanusmokrassar.TelegramBotAPI.requests.send
2019-01-17 02:43:51 +00:00
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.types.DisableWebPagePreview
import com.github.insanusmokrassar.TelegramBotAPI.requests.send.abstracts.*
2018-12-26 08:07:24 +00:00
import com.github.insanusmokrassar.TelegramBotAPI.types.*
import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.ParseMode
import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.parseModeField
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.KeyboardMarkup
import com.github.insanusmokrassar.TelegramBotAPI.types.message.RawMessage
import kotlinx.serialization.*
@Serializable
data class SendMessage(
@SerialName(chatIdField)
override val chatId: ChatIdentifier,
@SerialName(textField)
override val text: String,
@SerialName(parseModeField)
@Optional
override val parseMode: ParseMode? = null,
@SerialName(disableWebPagePreviewField)
@Optional
override val disableWebPagePreview: Boolean? = null,
@SerialName(disableNotificationField)
@Optional
override val disableNotification: Boolean = false,
@SerialName(replyToMessageIdField)
@Optional
override val replyToMessageId: MessageIdentifier? = null,
@SerialName(replyMarkupField)
@Optional
override val replyMarkup: KeyboardMarkup? = null
) : SendMessageRequest<RawMessage>,
ReplyingMarkupSendMessageRequest<RawMessage>,
TextableSendMessageRequest<RawMessage>,
DisableWebPagePreview
{
init {
if (text.length !in textLength) {
throw IllegalArgumentException("Text must be in $textLength range")
}
}
2018-12-26 08:07:24 +00:00
override fun method(): String = "sendMessage"
override fun resultSerializer(): KSerializer<RawMessage> = RawMessage.serializer()
}