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
}
// 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

View File

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