mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2024-11-22 16:23:48 +00:00
fix of #574
This commit is contained in:
parent
9014cdbc99
commit
92b4ba2ff0
@ -2,6 +2,9 @@
|
|||||||
|
|
||||||
## 0.38.17
|
## 0.38.17
|
||||||
|
|
||||||
|
* `Core`:
|
||||||
|
* Add `BotCommandScopeChat` as new `BotCommandScope` (fix of [#574](https://github.com/InsanusMokrassar/TelegramBotAPI/issues/574))
|
||||||
|
|
||||||
## 0.38.16
|
## 0.38.16
|
||||||
|
|
||||||
* `Core`:
|
* `Core`:
|
||||||
|
@ -22,11 +22,14 @@ private class SurrogateBotCommandScope(
|
|||||||
BotCommandScopeAllGroupChats.type -> BotCommandScopeAllGroupChats
|
BotCommandScopeAllGroupChats.type -> BotCommandScopeAllGroupChats
|
||||||
BotCommandScopeAllChatAdministrators.type -> BotCommandScopeAllChatAdministrators
|
BotCommandScopeAllChatAdministrators.type -> BotCommandScopeAllChatAdministrators
|
||||||
BotCommandScopeChatAdministrators.type -> BotCommandScopeChatAdministrators(
|
BotCommandScopeChatAdministrators.type -> BotCommandScopeChatAdministrators(
|
||||||
chatId ?: error("chat_administrators type must have $chatIdField field, but have no")
|
chatId ?: error("${BotCommandScopeChatAdministrators.type} type must have $chatIdField field, but have no")
|
||||||
)
|
)
|
||||||
BotCommandScopeChatMember.type -> BotCommandScopeChatMember(
|
BotCommandScopeChatMember.type -> BotCommandScopeChatMember(
|
||||||
chatId ?: error("chat_administrators type must have $chatIdField field, but have no"),
|
chatId ?: error("${BotCommandScopeChatMember.type} type must have $chatIdField field, but have no"),
|
||||||
userId ?: error("chat_administrators type must have $userIdField field, but have no")
|
userId ?: error("${BotCommandScopeChatMember.type} type must have $userIdField field, but have no")
|
||||||
|
)
|
||||||
|
BotCommandScopeChat.type -> BotCommandScopeChat(
|
||||||
|
chatId ?: error("${BotCommandScopeChat.type} type must have $chatIdField field, but have no")
|
||||||
)
|
)
|
||||||
else -> UnknownBotCommandScope(type)
|
else -> UnknownBotCommandScope(type)
|
||||||
}
|
}
|
||||||
@ -40,6 +43,7 @@ private class SurrogateBotCommandScope(
|
|||||||
BotCommandScopeAllChatAdministrators -> SurrogateBotCommandScope(scope.type)
|
BotCommandScopeAllChatAdministrators -> SurrogateBotCommandScope(scope.type)
|
||||||
is BotCommandScopeChatAdministrators -> SurrogateBotCommandScope(scope.type, scope.chatId)
|
is BotCommandScopeChatAdministrators -> SurrogateBotCommandScope(scope.type, scope.chatId)
|
||||||
is BotCommandScopeChatMember -> SurrogateBotCommandScope(scope.type, scope.chatId, scope.userId)
|
is BotCommandScopeChatMember -> SurrogateBotCommandScope(scope.type, scope.chatId, scope.userId)
|
||||||
|
is BotCommandScopeChat -> SurrogateBotCommandScope(scope.type, scope.chatId)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -94,6 +98,17 @@ data class BotCommandScopeChatAdministrators(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Serializable
|
||||||
|
data class BotCommandScopeChat(
|
||||||
|
override val chatId: ChatIdentifier
|
||||||
|
) : ChatBotCommandScope {
|
||||||
|
@Required
|
||||||
|
override val type: String = BotCommandScopeChat.type
|
||||||
|
companion object {
|
||||||
|
const val type = "chat"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Serializable
|
@Serializable
|
||||||
data class BotCommandScopeChatMember(
|
data class BotCommandScopeChatMember(
|
||||||
override val chatId: ChatIdentifier,
|
override val chatId: ChatIdentifier,
|
||||||
|
Loading…
Reference in New Issue
Block a user