Archived
1
This repository has been archived on 2022-11-04. You can view files and clone it, but cannot push or open issues or pull requests.
fwzookeeper/vendor/gitlab.com/toby3d/telegram/leave_chat.go
2018-11-29 20:32:51 +04:00

26 lines
599 B
Go

package telegram
import json "github.com/pquerna/ffjson/ffjson"
// LeaveChatParameters represents data for LeaveChat method.
type LeaveChatParameters struct {
// Unique identifier for the target chat
ChatID int64 `json:"chat_id"`
}
// LeaveChat leave a group, supergroup or channel. Returns True on success.
func (bot *Bot) LeaveChat(chatID int64) (ok bool, err error) {
dst, err := json.Marshal(&LeaveChatParameters{ChatID: chatID})
if err != nil {
return
}
resp, err := bot.request(dst, MethodLeaveChat)
if err != nil {
return
}
err = json.Unmarshal(*resp.Result, &ok)
return
}