Add support for forwarded messages. Closes #313

pull/330/head
Wim 7 years ago
parent d30ae19e2a
commit e4a0e0a0e9

@ -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 := ""

Loading…
Cancel
Save