mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2024-12-23 09:07:12 +00:00
add restrictions check in SetChatAdministratorCustomTitle
This commit is contained in:
parent
47428dd6f9
commit
5ee472305c
@ -1,12 +1,15 @@
|
||||
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
|
||||
|
||||
/**
|
||||
* Representation of https://core.telegram.org/bots/api#setchatadministratorcustomtitle
|
||||
*
|
||||
* Please, remember about restrictions for characters in custom title
|
||||
*/
|
||||
@Serializable
|
||||
data class SetChatAdministratorCustomTitle(
|
||||
@SerialName(chatIdField)
|
||||
@ -21,4 +24,10 @@ data class SetChatAdministratorCustomTitle(
|
||||
get() = BooleanSerializer
|
||||
override val requestSerializer: SerializationStrategy<*>
|
||||
get() = RestrictChatMember.serializer()
|
||||
|
||||
init {
|
||||
if (customTitle.length !in customTitleLength) {
|
||||
throw IllegalArgumentException("Custom title length must be in range $customTitleLength, but was ${customTitle.length}")
|
||||
}
|
||||
}
|
||||
}
|
@ -40,6 +40,8 @@ val livePeriodLimit = 60 .. 86400
|
||||
|
||||
val inlineQueryAnswerResultsLimit = 0 .. 50
|
||||
|
||||
val customTitleLength = 0 .. 16
|
||||
|
||||
const val chatIdField = "chat_id"
|
||||
const val messageIdField = "message_id"
|
||||
const val updateIdField = "update_id"
|
||||
|
Loading…
Reference in New Issue
Block a user