diff options
Diffstat (limited to 'telegram/utils.go')
-rw-r--r-- | telegram/utils.go | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/telegram/utils.go b/telegram/utils.go index 851c6c1..0a2ae1f 100644 --- a/telegram/utils.go +++ b/telegram/utils.go @@ -987,7 +987,7 @@ func (c *Client) ProcessIncomingMessage(chatId int64, message *client.Message) { } // ProcessOutgoingMessage executes commands or sends messages to mapped chats -func (c *Client) ProcessOutgoingMessage(chatID int64, text string, returnJid string, replyId int64) client.InputMessageContent { +func (c *Client) ProcessOutgoingMessage(chatID int64, text string, returnJid string, id string, replyId int64) client.InputMessageContent { if !c.Online() { // we're offline return nil @@ -1111,7 +1111,7 @@ func (c *Client) ProcessOutgoingMessage(chatID int64, text string, returnJid str } if chatID != 0 { - _, err := c.client.SendMessage(&client.SendMessageRequest{ + tgMessage, err := c.client.SendMessage(&client.SendMessageRequest{ ChatId: chatID, ReplyToMessageId: reply, InputMessageContent: message, @@ -1123,6 +1123,11 @@ func (c *Client) ProcessOutgoingMessage(chatID int64, text string, returnJid str fmt.Sprintf("Not sent: %s", err.Error()), c.xmpp, ) + } else { + err = gateway.IdsDB.Set(c.Session.Login, c.jid, tgMessage.ChatId, tgMessage.Id, id) + if err != nil { + log.Errorf("Failed to save ids %v/%v %v", tgMessage.ChatId, tgMessage.Id, id) + } } return nil } else { |