From f2ef2729ab6c83b860cde5326e70b3c143b00ec3 Mon Sep 17 00:00:00 2001 From: Syfaro Date: Fri, 3 Dec 2021 21:44:02 -0500 Subject: [PATCH] Add alias for kickChatMember rename. --- configs.go | 15 ++++++++++----- types_test.go | 1 + 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/configs.go b/configs.go index 996f7b9..db8ada6 100644 --- a/configs.go +++ b/configs.go @@ -1294,18 +1294,18 @@ func (config UnbanChatMemberConfig) params() (Params, error) { 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) @@ -1316,6 +1316,11 @@ func (config KickChatMemberConfig) params() (Params, error) { 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 { ChatMemberConfig diff --git a/types_test.go b/types_test.go index 7742556..af3cd67 100644 --- a/types_test.go +++ b/types_test.go @@ -281,6 +281,7 @@ func TestFileLink(t *testing.T) { var ( _ Chattable = AnimationConfig{} _ Chattable = AudioConfig{} + _ Chattable = BanChatMemberConfig{} _ Chattable = CallbackConfig{} _ Chattable = ChatActionConfig{} _ Chattable = ChatAdministratorsConfig{}