diff options
author | Wim <wim@42.be> | 2017-11-12 22:04:35 +0100 |
---|---|---|
committer | Wim <wim@42.be> | 2017-11-12 22:04:35 +0100 |
commit | 6d21f84187cddf17a2758a57bc77c37ed9e7ba70 (patch) | |
tree | 50891307eb1abd2573ee9e249ddf9f440a39643e | |
parent | f1e98333106492b489fc0cd25d485b4dc569cff9 (diff) | |
download | matterbridge-msglm-6d21f84187cddf17a2758a57bc77c37ed9e7ba70.tar.gz matterbridge-msglm-6d21f84187cddf17a2758a57bc77c37ed9e7ba70.tar.bz2 matterbridge-msglm-6d21f84187cddf17a2758a57bc77c37ed9e7ba70.zip |
Add extension to sticker/video/photo (telegram)
-rw-r--r-- | bridge/telegram/telegram.go | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/bridge/telegram/telegram.go b/bridge/telegram/telegram.go index 197f7606..f4662669 100644 --- a/bridge/telegram/telegram.go +++ b/bridge/telegram/telegram.go @@ -3,6 +3,7 @@ package btelegram import ( "regexp" "strconv" + "strings" "github.com/42wim/matterbridge/bridge/config" "github.com/42wim/matterbridge/bridge/helper" @@ -232,20 +233,23 @@ func (b *Btelegram) handleDownload(file interface{}, msg *config.Message) { case *tgbotapi.Sticker: size = v.FileSize url = b.getFileDirectURL(v.FileID) - name = "sticker" + urlPart := strings.Split(url, "/") + name = urlPart[len(urlPart)-1] text = " " + url fileid = v.FileID case *tgbotapi.Video: size = v.FileSize url = b.getFileDirectURL(v.FileID) - name = "video" + urlPart := strings.Split(url, "/") + name = urlPart[len(urlPart)-1] text = " " + url fileid = v.FileID case *[]tgbotapi.PhotoSize: photos := *v size = photos[len(photos)-1].FileSize url = b.getFileDirectURL(photos[len(photos)-1].FileID) - name = "photo" + urlPart := strings.Split(url, "/") + name = urlPart[len(urlPart)-1] text = " " + url case *tgbotapi.Document: size = v.FileSize |