Add exportChatInviteLink method

bot-api-6.1
Mikhail Markov 2017-07-17 20:48:51 +03:00 committed by GitHub
parent ebe7b8254e
commit def5c3f6c9
1 changed files with 18 additions and 0 deletions

18
bot.go
View File

@ -834,3 +834,21 @@ func (bot *BotAPI) DeleteMessage(config DeleteMessageConfig) (APIResponse, error
return bot.MakeRequest(config.method(), v)
}
// GetInviteLink get InviteLink for a chat
func (bot *BotAPI) GetInviteLink(config ChatConfig) (string, error) {
v := url.Values{}
if config.SuperGroupUsername == "" {
v.Add("chat_id", strconv.FormatInt(config.ChatID, 10))
} else {
v.Add("chat_id", config.SuperGroupUsername)
}
resp, err := bot.MakeRequest("exportChatInviteLink", v)
var inviteLink string
err = json.Unmarshal(resp.Result, &inviteLink)
return inviteLink, err
}