all repos — telegram-bot-api @ 12f3478326f8700fe7d9248d1b991d5d11c5c980

Golang bindings for the Telegram Bot API

feat(bot): implement unban chat member for channels
Mohamad Jahani m4m4lj@gmail.com
Sun, 18 Jun 2017 21:29:25 +0430
commit

12f3478326f8700fe7d9248d1b991d5d11c5c980

parent

d23f8e850e134a13dbbc77d5378ff28981853646

2 files changed, 7 insertions(+), 4 deletions(-)

jump to
M bot.gobot.go

@@ -674,14 +674,16 @@ return member, err

} // UnbanChatMember unbans a user from a chat. Note that this only will work -// in supergroups, and requires the bot to be an admin. +// in supergroups and channels, and requires the bot to be an admin. func (bot *BotAPI) UnbanChatMember(config ChatMemberConfig) (APIResponse, error) { v := url.Values{} - if config.SuperGroupUsername == "" { - v.Add("chat_id", strconv.FormatInt(config.ChatID, 10)) - } else { + if config.SuperGroupUsername != "" { v.Add("chat_id", config.SuperGroupUsername) + } else if config.ChannelUsername != "" { + v.Add("chat_id", config.ChannelUsername) + } else { + v.Add("chat_id", strconv.FormatInt(config.ChatID, 10)) } v.Add("user_id", strconv.Itoa(config.UserID))
M configs.goconfigs.go

@@ -883,6 +883,7 @@ // with administrative functions such as kicking or unbanning a user.

type ChatMemberConfig struct { ChatID int64 SuperGroupUsername string + ChannelUsername string UserID int }