Merge pull request #111 from xrayid/master

Add exportChatInviteLink method
bot-api-6.1
Syfaro 2017-07-17 13:35:43 -05:00 committed by GitHub
commit 3d983182a3
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) 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
}