Add alias for kickChatMember rename.

bot-api-6.1
Syfaro 2021-12-03 21:44:02 -05:00
parent 0d342c8d5a
commit f2ef2729ab
2 changed files with 11 additions and 5 deletions

View File

@ -1294,18 +1294,18 @@ func (config UnbanChatMemberConfig) params() (Params, error) {
return params, nil return params, nil
} }
// KickChatMemberConfig contains extra fields to kick user // BanChatMemberConfig contains extra fields to kick user.
type KickChatMemberConfig struct { type BanChatMemberConfig struct {
ChatMemberConfig ChatMemberConfig
UntilDate int64 UntilDate int64
RevokeMessages bool RevokeMessages bool
} }
func (config KickChatMemberConfig) method() string { func (config BanChatMemberConfig) method() string {
return "kickChatMember" return "banChatMember"
} }
func (config KickChatMemberConfig) params() (Params, error) { func (config BanChatMemberConfig) params() (Params, error) {
params := make(Params) params := make(Params)
params.AddFirstValid("chat_id", config.ChatID, config.SuperGroupUsername) params.AddFirstValid("chat_id", config.ChatID, config.SuperGroupUsername)
@ -1316,6 +1316,11 @@ func (config KickChatMemberConfig) params() (Params, error) {
return params, nil 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 // RestrictChatMemberConfig contains fields to restrict members of chat
type RestrictChatMemberConfig struct { type RestrictChatMemberConfig struct {
ChatMemberConfig ChatMemberConfig

View File

@ -281,6 +281,7 @@ func TestFileLink(t *testing.T) {
var ( var (
_ Chattable = AnimationConfig{} _ Chattable = AnimationConfig{}
_ Chattable = AudioConfig{} _ Chattable = AudioConfig{}
_ Chattable = BanChatMemberConfig{}
_ Chattable = CallbackConfig{} _ Chattable = CallbackConfig{}
_ Chattable = ChatActionConfig{} _ Chattable = ChatActionConfig{}
_ Chattable = ChatAdministratorsConfig{} _ Chattable = ChatAdministratorsConfig{}