diff options
author | Wim <wim@42.be> | 2017-11-12 17:46:44 +0100 |
---|---|---|
committer | Wim <wim@42.be> | 2017-11-12 17:46:44 +0100 |
commit | 64c542e6148c4fc089da1df72672fc7c2c20147b (patch) | |
tree | fd6bca9eecafd21a926ec3b06608c57594e23bc8 /bridge | |
parent | 13d081ea80203ba6ec2da03200fbaac8131e5696 (diff) | |
download | matterbridge-msglm-64c542e6148c4fc089da1df72672fc7c2c20147b.tar.gz matterbridge-msglm-64c542e6148c4fc089da1df72672fc7c2c20147b.tar.bz2 matterbridge-msglm-64c542e6148c4fc089da1df72672fc7c2c20147b.zip |
Add more debug info (telegram)
Diffstat (limited to 'bridge')
-rw-r--r-- | bridge/telegram/telegram.go | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/bridge/telegram/telegram.go b/bridge/telegram/telegram.go index 2b815d94..654f8755 100644 --- a/bridge/telegram/telegram.go +++ b/bridge/telegram/telegram.go @@ -227,28 +227,33 @@ func (b *Btelegram) handleDownload(file interface{}, msg *config.Message) { url := "" name := "" text := "" + fileid := "" switch v := file.(type) { case *tgbotapi.Sticker: size = v.FileSize url = b.getFileDirectURL(v.FileID) name = "sticker" text = " " + url + fileid = v.FileID case *tgbotapi.Video: size = v.FileSize url = b.getFileDirectURL(v.FileID) name = "video" 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" text = " " + url + fileid = v.FileID case *tgbotapi.Document: size = v.FileSize url = b.getFileDirectURL(v.FileID) name = v.FileName text = " " + v.FileName + " : " + url + fileid = v.FileID } if b.Config.UseInsecureURL { msg.Text = text @@ -256,11 +261,13 @@ func (b *Btelegram) handleDownload(file interface{}, msg *config.Message) { } // if we have a file attached, download it (in memory) and put a pointer to it in msg.Extra // limit to 1MB for now + flog.Debugf("trying to download %#v fileid %#v with size %#v", name, fileid, size) if size <= 1000000 { data, err := helper.DownloadFile(url) if err != nil { flog.Errorf("download %s failed %#v", url, err) } else { + flog.Debugf("download OK %#v %#v %#v", name, len(data), len(url)) msg.Extra["file"] = append(msg.Extra["file"], config.FileInfo{Name: name, Data: data}) } } |