From 14490bea9fc997e2af3f285c8e86fd5424965a6d Mon Sep 17 00:00:00 2001 From: Wim <wim@42.be> Date: Mon, 11 Sep 2017 23:12:33 +0200 Subject: [PATCH] Add partial support for deleted messages (telegram) --- bridge/telegram/telegram.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/bridge/telegram/telegram.go b/bridge/telegram/telegram.go index 77a5f4e8..937dfe9c 100644 --- a/bridge/telegram/telegram.go +++ b/bridge/telegram/telegram.go @@ -68,6 +68,18 @@ func (b *Btelegram) Send(msg config.Message) (string, error) { msg.Text = makeHTML(msg.Text) } + if msg.Event == config.EVENT_MSG_DELETE { + if msg.ID == "" { + return "", nil + } + msgid, err := strconv.Atoi(msg.ID) + if err != nil { + return "", err + } + _, err = b.c.DeleteMessage(tgbotapi.DeleteMessageConfig{ChatID: chatid, MessageID: msgid}) + return "", err + } + // edit the message if we have a msg ID if msg.ID != "" { msgid, err := strconv.Atoi(msg.ID)