From 64c542e6148c4fc089da1df72672fc7c2c20147b Mon Sep 17 00:00:00 2001 From: Wim Date: Sun, 12 Nov 2017 17:46:44 +0100 Subject: Add more debug info (telegram) --- bridge/telegram/telegram.go | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'bridge/telegram') 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}) } } -- cgit v1.2.3