all repos — telegram-bot-api @ 3d983182a388146c7e9e3b0f0486a560f810dc3d

Golang bindings for the Telegram Bot API

Merge pull request #111 from xrayid/master

Add exportChatInviteLink method
Syfaro syfaro@foxpaw.in
Mon, 17 Jul 2017 13:35:43 -0500
commit

3d983182a388146c7e9e3b0f0486a560f810dc3d

parent

ebe7b8254e1592d3701010dc4f927a87b3559397

1 files changed, 18 insertions(+), 0 deletions(-)

jump to
M bot.gobot.go

@@ -834,3 +834,21 @@ bot.debugLog(config.method(), v, nil)

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 +}