5
0
mirror of https://github.com/cwinfo/matterbridge.git synced 2024-11-14 03:50:26 +00:00

Add support for forwarded messages. Closes #313

This commit is contained in:
Wim 2017-12-10 14:52:29 +01:00
parent d30ae19e2a
commit e4a0e0a0e9

View File

@ -180,6 +180,24 @@ func (b *Btelegram) handleRecv(updates <-chan tgbotapi.Update) {
b.handleDownload(message.Document, &fmsg) 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 // quote the previous message
if message.ReplyToMessage != nil { if message.ReplyToMessage != nil {
usernameReply := "" usernameReply := ""