test
This commit is contained in:
parent
71c28649cc
commit
b2c5eaa754
25
bot.go
25
bot.go
@ -288,18 +288,25 @@ func botMsgLoad(m *tb.Message) {
|
|||||||
TGCmdQueue <- c
|
TGCmdQueue <- c
|
||||||
r, err := b.GetFile(&f)
|
r, err := b.GetFile(&f)
|
||||||
logOnError(err, "botMsgLoad : GetFile")
|
logOnError(err, "botMsgLoad : GetFile")
|
||||||
_, err := ioutil.ReadAll(r.Body)
|
buf := new(bytes.Buffer)
|
||||||
c = TGCommand{
|
n, err := buf.ReadFrom(r.Reader)
|
||||||
Type: commandReplyMsg,
|
logOnError(err, "botMsgLoad : ReadFrom")
|
||||||
Text: "File downloaded ?",
|
if n > 0 {
|
||||||
FromMsgID64: int64(m.ID),
|
data := buf.Bytes()
|
||||||
FromChatID64: m.Chat.ID,
|
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
|
||||||
}
|
}
|
||||||
TGCmdQueue <- c
|
|
||||||
if f.OnDisk() {
|
if f.OnDisk() {
|
||||||
c = TGCommand{
|
c = TGCommand{
|
||||||
Type: commandReplyMsg,
|
Type: commandReplyMsg,
|
||||||
Text: "Yes !",
|
Text: "File now on disk !",
|
||||||
FromMsgID64: int64(m.ID),
|
FromMsgID64: int64(m.ID),
|
||||||
FromChatID64: m.Chat.ID,
|
FromChatID64: m.Chat.ID,
|
||||||
}
|
}
|
||||||
@ -307,7 +314,7 @@ func botMsgLoad(m *tb.Message) {
|
|||||||
} else {
|
} else {
|
||||||
c = TGCommand{
|
c = TGCommand{
|
||||||
Type: commandReplyMsg,
|
Type: commandReplyMsg,
|
||||||
Text: "No !",
|
Text: "Still not on disk ?",
|
||||||
FromMsgID64: int64(m.ID),
|
FromMsgID64: int64(m.ID),
|
||||||
FromChatID64: m.Chat.ID,
|
FromChatID64: m.Chat.ID,
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user