summaryrefslogtreecommitdiffstats
path: root/bridge/telegram/telegram.go
diff options
context:
space:
mode:
authorWim <wim@42.be>2017-12-10 14:52:29 +0100
committerWim <wim@42.be>2017-12-10 14:52:29 +0100
commite4a0e0a0e950599be49a88ec254b4bfad0779cf4 (patch)
tree5ce8d0e9f857e0500b4ca149eefb605c26c22e7c /bridge/telegram/telegram.go
parentd30ae19e2a789f7bf5d430f9c7d065268d6a2957 (diff)
downloadmatterbridge-msglm-e4a0e0a0e950599be49a88ec254b4bfad0779cf4.tar.gz
matterbridge-msglm-e4a0e0a0e950599be49a88ec254b4bfad0779cf4.tar.bz2
matterbridge-msglm-e4a0e0a0e950599be49a88ec254b4bfad0779cf4.zip
Add support for forwarded messages. Closes #313
Diffstat (limited to 'bridge/telegram/telegram.go')
-rw-r--r--bridge/telegram/telegram.go18
1 files changed, 18 insertions, 0 deletions
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 := ""