go-telegram-bot-api / telegram-bot-api

Golang bindings for the Telegram Bot API
https://go-telegram-bot-api.dev
MIT License
5.62k stars 868 forks source link

why remove KickChatMember function from BotAPI in v5? #613

Open jenningszheng opened 1 year ago

jenningszheng commented 1 year ago

v5 documentation: https://pkg.go.dev/github.com/go-telegram-bot-api/telegram-bot-api/v5#BotAPI v4.6.4 documentation: https://pkg.go.dev/github.com/go-telegram-bot-api/telegram-bot-api#BotAPI.KickChatMember

why remove KickChatMember function from BotAPI in v5?

jenningszheng commented 1 year ago

anyone else can help? plz

hanwenyue commented 1 year ago

same question

elidotexe commented 1 year ago

I share the same inquiry as well. With the removal of KickChatMember/BanChatMember, the latest version seems to lack clarity on how to kick/ban users.

elidotexe commented 1 year ago

In case someone is still facing the same problem, the solution is to use 'Request' instead of 'KickChatMember'. I hope this helps ;)

h.logger.Infof("Banning bot: %v", GetUsername(&user))

banChatMemberConfig := tgbotapi.BanChatMemberConfig{
    ChatMemberConfig: tgbotapi.ChatMemberConfig{
        ChatID: ctx.Chat.ID,
        UserID: user.ID,
    },
    RevokeMessages: false,
}

h.bot.Request(banChatMemberConfig)