test
This commit is contained in:
parent
71c28649cc
commit
b2c5eaa754
15
bot.go
15
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)
|
||||||
|
n, err := buf.ReadFrom(r.Reader)
|
||||||
|
logOnError(err, "botMsgLoad : ReadFrom")
|
||||||
|
if n > 0 {
|
||||||
|
data := buf.Bytes()
|
||||||
|
s := fmt.Sprintf("Read %d/%d bytes.", n, len(data))
|
||||||
|
|
||||||
c = TGCommand{
|
c = TGCommand{
|
||||||
Type: commandReplyMsg,
|
Type: commandReplyMsg,
|
||||||
Text: "File downloaded ?",
|
Text: s,
|
||||||
FromMsgID64: int64(m.ID),
|
FromMsgID64: int64(m.ID),
|
||||||
FromChatID64: m.Chat.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