Thumbnail

rani/matterbridge.git

Clone URL: https://git.buni.party/rani/matterbridge.git

commit a2673f885ae329054de62067c53ceb43c029010d Author: Wim <wim@42.be> Date: Sat Jun 17 18:25:17 2017 +0000 Add initial sticker/video/photo/document support (telegram). #184 diff --git a/bridge/telegram/telegram.go b/bridge/telegram/telegram.go index b022434..fa6975e 100644 --- a/bridge/telegram/telegram.go +++ b/bridge/telegram/telegram.go @@ -1149 +11431 @@ func (b *Btelegram) handleRecv(updates <-chan tgbotapi.Update) {   if username == "" {   username = "unknown"   } + if message.Sticker != nil { + text = text + " " + b.getFileDirectURL(message.Sticker.FileID) + } + if message.Video != nil { + text = text + " " + b.getFileDirectURL(message.Video.FileID) + } + if message.Photo != nil { + for _, p := range *message.Photo { + text = text + " " + b.getFileDirectURL(p.FileID) + } + } + if message.Document != nil { + text = text + " " + message.Document.FileName + " : " + b.getFileDirectURL(message.Document.FileID) + }   if text != "" {   flog.Debugf("Sending message from %s on %s to gateway", username, b.Account)   b.Remote <- config.Message{Username: username, Text: text, Channel: channel, Account: b.Account}   }   }  } + +func (b *Btelegram) getFileDirectURL(id string) string { + res, err := b.c.GetFileDirectURL(id) + if err != nil { + return "" + } + return res +}