telegram-bot-api icon indicating copy to clipboard operation
telegram-bot-api copied to clipboard

why remove KickChatMember function from BotAPI in v5?

Open jenningszheng opened this issue 3 years ago • 4 comments

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 avatar Nov 21 '22 09:11 jenningszheng

anyone else can help? plz

jenningszheng avatar Nov 27 '22 14:11 jenningszheng

same question

hanwenyue avatar Jan 11 '23 10:01 hanwenyue

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 avatar Apr 06 '23 22:04 elidotexe

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)

elidotexe avatar Apr 11 '23 22:04 elidotexe