From 8a0b9cfac18ff685e0c69bc61352931e0305c288 Mon Sep 17 00:00:00 2001 From: Alexander Kiryukhin Date: Tue, 9 Apr 2019 18:05:20 +0300 Subject: Fix send to groups --- api.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/api.go b/api.go index ec45e73..5444d9b 100644 --- a/api.go +++ b/api.go @@ -222,7 +222,7 @@ func (a *Api) SendAction(chatID int64, action SenderAction) (*SimpleQueryResult, func (a *Api) GetMessages(chatID int64, messageIDs []string, from int64, to int64, count int64) (*MessageList, error) { result := new(MessageList) values := url.Values{} - if chatID > 0 { + if chatID != 0 { values.Set("chat_id", strconv.Itoa(int(chatID))) } if len(messageIDs) > 0 { @@ -230,11 +230,11 @@ func (a *Api) GetMessages(chatID int64, messageIDs []string, from int64, to int6 values.Add("message_ids", mid) } } - if from > 0 { + if from != 0 { values.Set("from", strconv.Itoa(int(from))) } - if to > 0 { - values.Set("count", strconv.Itoa(int(to))) + if to != 0 { + values.Set("to", strconv.Itoa(int(to))) } if count > 0 { values.Set("count", strconv.Itoa(int(count))) @@ -250,10 +250,10 @@ func (a *Api) GetMessages(chatID int64, messageIDs []string, from int64, to int6 func (a *Api) SendMessage(chatID int64, userID int64, message *NewMessageBody) (*Message, error) { result := new(Message) values := url.Values{} - if chatID > 0 { + if chatID != 0 { values.Set("chat_id", strconv.Itoa(int(chatID))) } - if userID > 0 { + if userID != 0 { values.Set("user_id", strconv.Itoa(int(userID))) } body, err := a.request(http.MethodPost, "messages", values, message) -- cgit v1.2.3