diff options
author | Alexander Kiryukhin <a.kiryukhin@mail.ru> | 2019-08-09 02:16:08 +0300 |
---|---|---|
committer | Alexander Kiryukhin <a.kiryukhin@mail.ru> | 2019-08-09 02:16:08 +0300 |
commit | 188740f248bf26934aa8db832f5c9c9b9418b2fc (patch) | |
tree | 89f2c9f5ab9ba267862d16b9d0dc048b00f06fea /messages.go | |
parent | 94c96cef29cd83bc60b2eabb8bb89c9fd8c7059b (diff) |
0.1.8 Release -- small fixes
Diffstat (limited to 'messages.go')
-rw-r--r-- | messages.go | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/messages.go b/messages.go index c7cad45..66db7da 100644 --- a/messages.go +++ b/messages.go @@ -1,5 +1,5 @@ -// Package tamtam implements TamTam Bot API -// Copyright (c) 2019 Alexander Kiryukhin <a.kiryukhin@mail.ru> +//Package tamtam implements TamTam Bot API +//Copyright (c) 2019 Alexander Kiryukhin <a.kiryukhin@mail.ru> package tamtam import ( @@ -18,6 +18,7 @@ func newMessages(client *client) *messages { return &messages{client: client} } +//GetMessages returns messages in chat: result page and marker referencing to the next page. Messages traversed in reverse direction so the latest message in chat will be first in result array. Therefore if you use from and to parameters, to must be less than from func (a *messages) GetMessages(chatID int, messageIDs []string, from int, to int, count int) (*MessageList, error) { result := new(MessageList) values := url.Values{} @@ -50,6 +51,7 @@ func (a *messages) GetMessages(chatID int, messageIDs []string, from int, to int return result, json.NewDecoder(body).Decode(result) } +//SendMessage sends a message to a chat. As a result for this method new message identifier returns. func (a *messages) SendMessage(chatID int, userID int, message *NewMessageBody) (*Message, error) { result := new(Message) values := url.Values{} @@ -71,6 +73,7 @@ func (a *messages) SendMessage(chatID int, userID int, message *NewMessageBody) return result, json.NewDecoder(body).Decode(result) } +//EditMessage updates message by id func (a *messages) EditMessage(messageID int, message *NewMessageBody) (*SimpleQueryResult, error) { result := new(SimpleQueryResult) values := url.Values{} @@ -87,6 +90,7 @@ func (a *messages) EditMessage(messageID int, message *NewMessageBody) (*SimpleQ return result, json.NewDecoder(body).Decode(result) } +//DeleteMessage deletes message by id func (a *messages) DeleteMessage(messageID int) (*SimpleQueryResult, error) { result := new(SimpleQueryResult) values := url.Values{} @@ -103,6 +107,7 @@ func (a *messages) DeleteMessage(messageID int) (*SimpleQueryResult, error) { return result, json.NewDecoder(body).Decode(result) } +//AnswerOnCallback should be called to send an answer after a user has clicked the button. The answer may be an updated message or/and a one-time user notification. func (a *messages) AnswerOnCallback(callbackID int, callback *CallbackAnswer) (*SimpleQueryResult, error) { result := new(SimpleQueryResult) values := url.Values{} @@ -119,6 +124,7 @@ func (a *messages) AnswerOnCallback(callbackID int, callback *CallbackAnswer) (* return result, json.NewDecoder(body).Decode(result) } +//NewKeyboardBuilder returns new keyboard builder helper func (a *messages) NewKeyboardBuilder() *KeyboardBuilder { return &KeyboardBuilder{ rows: make([]*KeyboardRow, 0), |