Skip to content

Commit

Permalink
fixed messages forward
Browse files Browse the repository at this point in the history
  • Loading branch information
George Gabolaev committed Jan 31, 2020
1 parent f6dc228 commit 857bf63
Show file tree
Hide file tree
Showing 7 changed files with 100 additions and 82 deletions.
12 changes: 6 additions & 6 deletions chat_easyjson.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 18 additions & 0 deletions client.go
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,15 @@ func (c *Client) SendFileMessage(message *Message) error {
"fileId": {message.FileID},
}

if message.ReplyMsgID != "" {
params.Set("replyMsgId", message.ReplyMsgID)
}

if message.ForwardMsgID != "" {
params.Set("forwardMsgId", message.ForwardMsgID)
params.Set("forwardChatId", message.ForwardChatID)
}

response, err := c.Do("/messages/sendFile", params, nil)
if err != nil {
return fmt.Errorf("error while making request: %s", err)
Expand All @@ -253,6 +262,15 @@ func (c *Client) SendVoiceMessage(message *Message) error {
"fileId": {message.FileID},
}

if message.ReplyMsgID != "" {
params.Set("replyMsgId", message.ReplyMsgID)
}

if message.ForwardMsgID != "" {
params.Set("forwardMsgId", message.ForwardMsgID)
params.Set("forwardChatId", message.ForwardChatID)
}

response, err := c.Do("/messages/sendVoice", params, nil)
if err != nil {
return fmt.Errorf("error while making request: %s", err)
Expand Down
12 changes: 6 additions & 6 deletions file_easyjson.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/mail-ru-im/bot-golang

go 1.12
go 1.13

require (
github.com/hako/durafmt v0.0.0-20190612201238-650ed9f29a84
Expand Down
2 changes: 1 addition & 1 deletion message.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ type Message struct {
// Id of a chat from which you forward the message
// You can't use it with ReplyMsgID
// You should use it with ForwardMsgID
ForwardChatID string `json:"replyChatId"`
ForwardChatID string `json:"forwardChatId"`

Timestamp int `json:"timestamp"`
}
Expand Down
16 changes: 8 additions & 8 deletions message_easyjson.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 857bf63

Please sign in to comment.