diff options
author | Wim <wim@42.be> | 2017-06-17 18:25:17 +0200 |
---|---|---|
committer | Wim <wim@42.be> | 2017-06-17 18:25:17 +0200 |
commit | 2a403f8b85aec092eef9216d717984aa5fdfd0b9 (patch) | |
tree | ab73960d22a032ed0b1163ba6c60561366923f4c /bridge | |
parent | c3d45a9f06c7cb1361eed382422493ecf05e3fa8 (diff) | |
download | matterbridge-msglm-2a403f8b85aec092eef9216d717984aa5fdfd0b9.tar.gz matterbridge-msglm-2a403f8b85aec092eef9216d717984aa5fdfd0b9.tar.bz2 matterbridge-msglm-2a403f8b85aec092eef9216d717984aa5fdfd0b9.zip |
Add initial sticker/video/photo/document support (telegram). #184
Diffstat (limited to 'bridge')
-rw-r--r-- | bridge/telegram/telegram.go | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/bridge/telegram/telegram.go b/bridge/telegram/telegram.go index b0224347..fa6975ee 100644 --- a/bridge/telegram/telegram.go +++ b/bridge/telegram/telegram.go @@ -114,9 +114,31 @@ 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 +} |