LeaveChat boolean result removed

This commit is contained in:
ahmdrz 2016-10-15 10:52:58 +03:30
parent e5cf14aeea
commit 622415d138

10
bot.go
View File

@ -652,13 +652,13 @@ func (b *Bot) GetFile(fileID string) (File, error) {
} }
// LeaveChat , Use this method for your bot to leave a group, supergroup or channel. Returns True on success. // LeaveChat , Use this method for your bot to leave a group, supergroup or channel. Returns True on success.
func (b *Bot) LeaveChat(recipient Recipient) (bool, error) { func (b *Bot) LeaveChat(recipient Recipient) error {
params := map[string]string{ params := map[string]string{
"chat_id": recipient.Destination(), "chat_id": recipient.Destination(),
} }
responseJSON, err := sendCommand("leaveChat", b.Token, params) responseJSON, err := sendCommand("leaveChat", b.Token, params)
if err != nil { if err != nil {
return false, err return err
} }
var responseRecieved struct { var responseRecieved struct {
@ -668,14 +668,14 @@ func (b *Bot) LeaveChat(recipient Recipient) (bool, error) {
err = json.Unmarshal(responseJSON, &responseRecieved) err = json.Unmarshal(responseJSON, &responseRecieved)
if err != nil { if err != nil {
return false, err return err
} }
if !responseRecieved.Ok { if !responseRecieved.Ok {
return false, fmt.Errorf("telebot: leaveChat failure %s", responseRecieved.Result) return fmt.Errorf("telebot: leaveChat failure %s", responseRecieved.Result)
} }
return responseRecieved.Result, nil return nil
} }
// GetChat get up to date information // GetChat get up to date information