1
0
mirror of https://github.com/InsanusMokrassar/TelegramBotAPI.git synced 2024-06-01 23:45:25 +00:00
tgbotapi/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/bot/GetMyCommands.kt

38 lines
1.2 KiB
Kotlin
Raw Normal View History

2020-10-04 11:06:30 +00:00
package dev.inmo.tgbotapi.requests.bot
2020-03-30 15:52:00 +00:00
2023-12-24 13:25:41 +00:00
import dev.inmo.micro_utils.language_codes.IetfLang
import dev.inmo.micro_utils.language_codes.IetfLangSerializer
2021-06-25 19:42:35 +00:00
import dev.inmo.tgbotapi.types.*
import dev.inmo.tgbotapi.types.commands.*
2020-03-30 15:52:00 +00:00
import kotlinx.serialization.*
import kotlinx.serialization.builtins.ListSerializer
private val getMyCommandsSerializer = ListSerializer(BotCommand.serializer())
@Serializable
2021-06-25 19:42:35 +00:00
data class GetMyCommands(
@SerialName(scopeField)
@Serializable(BotCommandScopeSerializer::class)
override val scope: BotCommandScope = BotCommandScopeDefault,
@SerialName(languageCodeField)
2023-12-24 13:25:41 +00:00
@Serializable(IetfLangSerializer::class)
override val ietfLanguageCode: IetfLang? = null
2021-06-25 19:42:35 +00:00
) : MyCommandsRequest<List<BotCommand>> {
2020-03-30 15:52:00 +00:00
override fun method(): String = "getMyCommands"
override val resultDeserializer: DeserializationStrategy<List<BotCommand>>
get() = getMyCommandsSerializer
override val requestSerializer: SerializationStrategy<*>
get() = serializer()
2021-06-25 19:42:35 +00:00
2021-08-05 17:36:01 +00:00
constructor(
scope: BotCommandScope = BotCommandScopeDefault,
languageCode: String?
) : this(
scope,
2023-12-24 13:25:41 +00:00
languageCode ?.let(::IetfLang)
2021-08-05 17:36:01 +00:00
)
2021-06-25 19:42:35 +00:00
companion object : MyCommandsRequest<List<BotCommand>> by GetMyCommands()
2020-03-30 15:52:00 +00:00
}