tgbotapi/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/modify/SetChatDescription.kt

28 lines
1.0 KiB
Kotlin
Raw Normal View History

2018-12-26 08:07:24 +00:00
package com.github.insanusmokrassar.TelegramBotAPI.requests.chat.modify
2019-02-07 03:25:49 +00:00
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.ChatRequest
2019-02-07 12:25:04 +00:00
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleRequest
2018-12-26 08:07:24 +00:00
import com.github.insanusmokrassar.TelegramBotAPI.types.*
import kotlinx.serialization.*
import kotlinx.serialization.internal.BooleanSerializer
@Serializable
data class SetChatDescription (
@SerialName(chatIdField)
override val chatId: ChatIdentifier,
@SerialName(descriptionField)
val description: String
): ChatRequest, SimpleRequest<Boolean> {
init {
if (description.length !in chatDescriptionLength) {
throw IllegalArgumentException("Chat description must be in $chatDescriptionLength range")
}
}
override fun method(): String = "setChatDescription"
2019-12-02 08:35:37 +00:00
override val resultDeserializer: DeserializationStrategy<Boolean>
get() = BooleanSerializer
override val requestSerializer: SerializationStrategy<*>
get() = serializer()
2018-12-26 08:07:24 +00:00
}