From b4e4bed622de16b4075533913041dae3e4403c33 Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Wed, 1 Jan 2020 21:45:39 +0600 Subject: [PATCH] added the new request SetChatAdministratorCustomTitle to manage the custom titles of administrators promoted by the bot. --- CHANGELOG.md | 2 ++ .../SetChatAdministratorCustomTitle.kt | 24 +++++++++++++++++++ .../TelegramBotAPI/types/Common.kt | 1 + 3 files changed, 27 insertions(+) create mode 100644 src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/members/SetChatAdministratorCustomTitle.kt diff --git a/CHANGELOG.md b/CHANGELOG.md index 9bf1065e12..c2174381db 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ ## 0.21.0 TelegramBotAPI 4.5 +* Added the new request `SetChatAdministratorCustomTitle` to manage the custom titles of administrators promoted by the +bot. * Added the field `slowModeDelay` to the `ExtendedSupergroupChat` objects. ## 0.20.0 MPP Migration diff --git a/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/members/SetChatAdministratorCustomTitle.kt b/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/members/SetChatAdministratorCustomTitle.kt new file mode 100644 index 0000000000..31f8aa3a62 --- /dev/null +++ b/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/members/SetChatAdministratorCustomTitle.kt @@ -0,0 +1,24 @@ +package com.github.insanusmokrassar.TelegramBotAPI.requests.chat.members + +import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.ChatRequest +import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleRequest +import com.github.insanusmokrassar.TelegramBotAPI.requests.chat.abstracts.ChatMemberRequest +import com.github.insanusmokrassar.TelegramBotAPI.types.* +import kotlinx.serialization.* +import kotlinx.serialization.internal.BooleanSerializer + +@Serializable +data class SetChatAdministratorCustomTitle( + @SerialName(chatIdField) + override val chatId: ChatId, + @SerialName(userIdField) + override val userId: UserId, + @SerialName(customTitleField) + val customTitle: String +) : ChatMemberRequest { + override fun method(): String = "setChatAdministratorCustomTitle" + override val resultDeserializer: DeserializationStrategy + get() = BooleanSerializer + override val requestSerializer: SerializationStrategy<*> + get() = RestrictChatMember.serializer() +} \ No newline at end of file diff --git a/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/Common.kt b/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/Common.kt index 60c4e11d78..be43314b59 100644 --- a/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/Common.kt +++ b/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/Common.kt @@ -95,6 +95,7 @@ const val switchInlineQueryField = "switch_inline_query" const val isAnimatedField = "is_animated" const val inviteLinkField = "invite_link" const val pinnedMessageField = "pinned_message" +const val customTitleField = "custom_title" const val requestWriteAccessField = "request_write_access"