Skip to content

Commit

Permalink
Add alias for kickChatMember rename.
Browse files Browse the repository at this point in the history
  • Loading branch information
Syfaro committed Dec 4, 2021
1 parent 0d342c8 commit f2ef272
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
15 changes: 10 additions & 5 deletions configs.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
Expand Down
1 change: 1 addition & 0 deletions types_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,7 @@ func TestFileLink(t *testing.T) {
var (
_ Chattable = AnimationConfig{}
_ Chattable = AudioConfig{}
_ Chattable = BanChatMemberConfig{}
_ Chattable = CallbackConfig{}
_ Chattable = ChatActionConfig{}
_ Chattable = ChatAdministratorsConfig{}
Expand Down

0 comments on commit f2ef272

Please sign in to comment.