diff options
Diffstat (limited to 'bridge/telegram/handlers.go')
-rw-r--r-- | bridge/telegram/handlers.go | 36 |
1 files changed, 23 insertions, 13 deletions
diff --git a/bridge/telegram/handlers.go b/bridge/telegram/handlers.go index 56fd6540..f73c8b0f 100644 --- a/bridge/telegram/handlers.go +++ b/bridge/telegram/handlers.go @@ -39,22 +39,32 @@ func (b *Btelegram) handleGroups(rmsg *config.Message, message *tgbotapi.Message // handleForwarded handles forwarded messages func (b *Btelegram) handleForwarded(rmsg *config.Message, message *tgbotapi.Message) { - if message.ForwardFrom != nil { - usernameForward := "" - if b.GetBool("UseFirstName") { - usernameForward = message.ForwardFrom.FirstName - } - if usernameForward == "" { - usernameForward = message.ForwardFrom.UserName - if usernameForward == "" { - usernameForward = message.ForwardFrom.FirstName - } - } + if message.ForwardDate == 0 { + return + } + + if message.ForwardFrom == nil { + rmsg.Text = "Forwarded from " + unknownUser + ": " + rmsg.Text + return + } + + usernameForward := "" + if b.GetBool("UseFirstName") { + usernameForward = message.ForwardFrom.FirstName + } + + if usernameForward == "" { + usernameForward = message.ForwardFrom.UserName if usernameForward == "" { - usernameForward = unknownUser + usernameForward = message.ForwardFrom.FirstName } - rmsg.Text = "Forwarded from " + usernameForward + ": " + rmsg.Text } + + if usernameForward == "" { + usernameForward = unknownUser + } + + rmsg.Text = "Forwarded from " + usernameForward + ": " + rmsg.Text } // handleQuoting handles quoting of previous messages |