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
1 changed files with 18 additions and 0 deletions

View File

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