test
This commit is contained in:
parent
2d66971e17
commit
787d6a0f7b
38
bot.go
38
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{
|
||||
|
Loading…
Reference in New Issue
Block a user