commonMain.com.github.insanusmokrassar.TelegramBotAPI.requests.bot.SetMyCommands.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of TelegramBotAPI-jvm Show documentation
Show all versions of TelegramBotAPI-jvm Show documentation
Library for Object-Oriented and type-safe work with Telegram Bot API
package com.github.insanusmokrassar.TelegramBotAPI.requests.bot
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleRequest
import com.github.insanusmokrassar.TelegramBotAPI.types.*
import kotlinx.serialization.*
import kotlinx.serialization.builtins.serializer
@Serializable
class SetMyCommands(
@SerialName(botCommandsField)
val commands: List
) : SimpleRequest {
override fun method(): String = "setMyCommands"
override val resultDeserializer: DeserializationStrategy
get() = Boolean.serializer()
override val requestSerializer: SerializationStrategy<*>
get() = serializer()
init {
if (commands.size !in botCommandsLimit) {
error("Bot commands list size able to be in range $botCommandsLimit, but incoming size is ${commands.size}")
}
}
}