diff options
author | ValdikSS <iam@valdikss.org.ru> | 2022-03-12 02:20:39 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-12 00:20:39 +0100 |
commit | 9c203327c07d8fd4161c47163f35dfea29ac83b1 (patch) | |
tree | 2b8ae1dcaf4b9b58f9186617e1ad0c4894cb9911 /bridge/telegram | |
parent | ccb5b1d0759ed1028aca994e6ab53c30435237f3 (diff) | |
download | matterbridge-msglm-9c203327c07d8fd4161c47163f35dfea29ac83b1.tar.gz matterbridge-msglm-9c203327c07d8fd4161c47163f35dfea29ac83b1.tar.bz2 matterbridge-msglm-9c203327c07d8fd4161c47163f35dfea29ac83b1.zip |
Fix Telegram channel title in forwards (#1753)
Forward from channels requires different handling than forward from the regular users.
This patch fixes the issue: it prints channel title instead of "forwarded from unknown".
Diffstat (limited to 'bridge/telegram')
-rw-r--r-- | bridge/telegram/handlers.go | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/bridge/telegram/handlers.go b/bridge/telegram/handlers.go index a27a6732..df3d6f8f 100644 --- a/bridge/telegram/handlers.go +++ b/bridge/telegram/handlers.go @@ -57,6 +57,11 @@ func (b *Btelegram) handleForwarded(rmsg *config.Message, message *tgbotapi.Mess return } + if message.ForwardFromChat != nil && message.ForwardFrom == nil { + rmsg.Text = "Forwarded from " + message.ForwardFromChat.Title + ": " + rmsg.Text + return + } + if message.ForwardFrom == nil { rmsg.Text = "Forwarded from " + unknownUser + ": " + rmsg.Text return |