From e4a0e0a0e950599be49a88ec254b4bfad0779cf4 Mon Sep 17 00:00:00 2001 From: Wim Date: Sun, 10 Dec 2017 14:52:29 +0100 Subject: Add support for forwarded messages. Closes #313 --- bridge/telegram/telegram.go | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'bridge/telegram/telegram.go') diff --git a/bridge/telegram/telegram.go b/bridge/telegram/telegram.go index 91e2e767..c2f69c3d 100644 --- a/bridge/telegram/telegram.go +++ b/bridge/telegram/telegram.go @@ -180,6 +180,24 @@ func (b *Btelegram) handleRecv(updates <-chan tgbotapi.Update) { b.handleDownload(message.Document, &fmsg) } + if message.ForwardFrom != nil { + text = "Forward from " + message.ForwardFrom.FirstName + usernameForward := "" + if b.Config.UseFirstName { + usernameForward = message.ForwardFrom.FirstName + } + if usernameForward == "" { + usernameForward = message.ForwardFrom.UserName + if usernameForward == "" { + usernameForward = message.ForwardFrom.FirstName + } + } + if usernameForward == "" { + usernameForward = "unknown" + } + text = "Forwarded from " + usernameForward + ": " + text + } + // quote the previous message if message.ReplyToMessage != nil { usernameReply := "" -- cgit v1.2.3