all repos — telegram-bot-api @ f2ef2729ab6c83b860cde5326e70b3c143b00ec3

Golang bindings for the Telegram Bot API

Add alias for kickChatMember rename.
Syfaro syfaro@huefox.com
Fri, 03 Dec 2021 21:44:02 -0500
commit

f2ef2729ab6c83b860cde5326e70b3c143b00ec3

parent

0d342c8d5a57169825b912328132052973094fc7

2 files changed, 11 insertions(+), 5 deletions(-)

jump to
M configs.goconfigs.go

@@ -1294,18 +1294,18 @@

return params, nil } -// KickChatMemberConfig contains extra fields to kick user -type KickChatMemberConfig struct { +// BanChatMemberConfig contains extra fields to kick user. +type BanChatMemberConfig struct { ChatMemberConfig UntilDate int64 RevokeMessages bool } -func (config KickChatMemberConfig) method() string { - return "kickChatMember" +func (config BanChatMemberConfig) method() string { + return "banChatMember" } -func (config KickChatMemberConfig) params() (Params, error) { +func (config BanChatMemberConfig) params() (Params, error) { params := make(Params) params.AddFirstValid("chat_id", config.ChatID, config.SuperGroupUsername)

@@ -1315,6 +1315,11 @@ params.AddBool("revoke_messages", config.RevokeMessages)

return params, nil } + +// KickChatMemberConfig contains extra fields to ban user. +// +// This was renamed to BanChatMember in later versions of the Telegram Bot API. +type KickChatMemberConfig = BanChatMemberConfig // RestrictChatMemberConfig contains fields to restrict members of chat type RestrictChatMemberConfig struct {
M types_test.gotypes_test.go

@@ -281,6 +281,7 @@ // Ensure all configs are sendable

var ( _ Chattable = AnimationConfig{} _ Chattable = AudioConfig{} + _ Chattable = BanChatMemberConfig{} _ Chattable = CallbackConfig{} _ Chattable = ChatActionConfig{} _ Chattable = ChatAdministratorsConfig{}