1
0
Fork 0
telegram/export_chat_invite_link.go

28 lines
785 B
Go

package telegram
import json "github.com/pquerna/ffjson/ffjson"
type ExportChatInviteLinkParameters struct {
// Unique identifier for the target chat
ChatID int64 `json:"chat_id"`
}
// ExportChatInviteLink export an invite link to a supergroup or a channel. The
// bot must be an administrator in the chat for this to work and must have the
// appropriate admin rights. Returns exported invite link as String on success.
func (bot *Bot) ExportChatInviteLink(chatID int64) (string, error) {
dst, err := json.Marshal(&ExportChatInviteLinkParameters{ChatID: chatID})
if err != nil {
return "", err
}
resp, err := bot.request(dst, MethodExportChatInviteLink)
if err != nil {
return "", err
}
var data string
err = json.Unmarshal(*resp.Result, &data)
return data, err
}