From d439b7a5810cc02a9170d5fd0f2b37ed8a684fd0 Mon Sep 17 00:00:00 2001 From: bodqhrohro Date: Sat, 21 Dec 2019 01:44:21 +0200 Subject: [PATCH] Respond for message sending errors --- telegram/utils.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/telegram/utils.go b/telegram/utils.go index ac100fd..1983367 100644 --- a/telegram/utils.go +++ b/telegram/utils.go @@ -496,10 +496,18 @@ func (c *Client) ProcessOutgoingMessage(chatID int64, text string, messageID int } } - c.client.SendMessage(&client.SendMessageRequest{ + _, err := c.client.SendMessage(&client.SendMessageRequest{ ChatId: chatID, ReplyToMessageId: reply, InputMessageContent: message, }) + if err != nil { + gateway.SendMessage( + returnJid, + strconv.FormatInt(chatID, 10), + fmt.Sprintf("Message not sent: %s", err.Error()), + c.xmpp, + ) + } } }