From 54589ed17b949d9b410a3b2565fd3424bae99cab Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Mon, 30 Mar 2020 21:40:36 +0600 Subject: [PATCH] BotCommand --- CHANGELOG.md | 1 + .../TelegramBotAPI/types/BotCommand.kt | 12 ++++++++++++ .../insanusmokrassar/TelegramBotAPI/types/Common.kt | 4 ++++ 3 files changed, 17 insertions(+) create mode 100644 TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/BotCommand.kt diff --git a/CHANGELOG.md b/CHANGELOG.md index c323f89e82..2b17fa808e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -31,6 +31,7 @@ * Request `SendDice` was added (calling [sendDice](https://core.telegram.org/bots/api#senddice)) * Class `Dice` was added (type [dice](https://core.telegram.org/bots/api#dice)) * Class `DiceContent` was added (for including it in [message](https://core.telegram.org/bots/api#message) object) + * `BotCommand` was added * `TelegramBotAPI-extensions-api`: * Extensions `sendDice` was added diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/BotCommand.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/BotCommand.kt new file mode 100644 index 0000000000..1e3e9ee01d --- /dev/null +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/BotCommand.kt @@ -0,0 +1,12 @@ +package com.github.insanusmokrassar.TelegramBotAPI.types + +import kotlinx.serialization.SerialName +import kotlinx.serialization.Serializable + +@Serializable +data class BotCommand( + @SerialName(botCommandField) + val command: String, + @SerialName(descriptionField) + val description: String +) diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/Common.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/Common.kt index 0f0c9647bd..bfff406189 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/Common.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/Common.kt @@ -48,6 +48,9 @@ val customTitleLength = 0 .. 16 val diceResultLimit = 1 .. 6 +val botCommandLimit = 1 .. 32 +val botCommandDescriptionLimit = 3 .. 256 + const val chatIdField = "chat_id" const val messageIdField = "message_id" const val updateIdField = "update_id" @@ -167,6 +170,7 @@ const val thumbHeightField = "thumb_height" const val inputMessageContentField = "input_message_content" const val hideUrlField = "hide_url" +const val botCommandField = "command" const val isMemberField = "is_member" const val canSendMessagesField = "can_send_messages"