From 787d6a0f7b60995c2e0659648d73aa10183f10af Mon Sep 17 00:00:00 2001 From: shoopea Date: Sun, 9 Jun 2019 19:44:34 +0800 Subject: [PATCH] test --- bot.go | 38 +++----------------------------------- 1 file changed, 3 insertions(+), 35 deletions(-) diff --git a/bot.go b/bot.go index dddd591..54ca14a 100644 --- a/bot.go +++ b/bot.go @@ -284,42 +284,10 @@ func botMsgLoad(m *tb.Message) { FromChatID64: m.Chat.ID, } TGCmdQueue <- c - log.Printf("Getting file !\n") - r, err := b.GetFile(&f) - logOnError(err, "botMsgLoad : GetFile") - log.Printf("Reading file !\n") - buf := new(bytes.Buffer) - n, err := buf.ReadFrom(r) - logOnError(err, "botMsgLoad : ReadFrom") - if n > 0 { - data := buf.Bytes() - s := fmt.Sprintf("Read %d/%d bytes.", n, len(data)) - c = TGCommand{ - Type: commandReplyMsg, - Text: s, - FromMsgID64: int64(m.ID), - FromChatID64: m.Chat.ID, - } - TGCmdQueue <- c - } - if f.OnDisk() { - c = TGCommand{ - Type: commandReplyMsg, - Text: "File now on disk !", - FromMsgID64: int64(m.ID), - FromChatID64: m.Chat.ID, - } - TGCmdQueue <- c - } else { - c = TGCommand{ - Type: commandReplyMsg, - Text: "Still not on disk ?", - FromMsgID64: int64(m.ID), - FromChatID64: m.Chat.ID, - } - TGCmdQueue <- c - } + url := fmt.Sprintf("%s/file/bot%s/%s", b.URL, b.Token, f.FilePath) + + log.Printf("Getting file from %s !\n", url) } else { c := TGCommand{