This commit is contained in:
shoopea 2019-05-16 19:34:26 +08:00
parent c3b0a88a9f
commit a7a2fe3875

View File

@ -180,9 +180,24 @@ func SQLJobWorker(id int) {
func TGCmdWorker(id int, b *tb.Bot, cmds <-chan TGCommand) {
log.Printf("TGCmdWorker[" + strconv.Itoa(id) + "] : Starting.")
for c := range cmds {
b, err := json.Marshal(c)
j, err := json.Marshal(c)
logOnError(err, "TGCmdWorker["+strconv.Itoa(id)+"] : Marshal(c)")
log.Printf("TGCmdWorker["+strconv.Itoa(id)+"] : new command.\n%s\n", string(b))
log.Printf("TGCmdWorker["+strconv.Itoa(id)+"] : new command.\n%s\n", string(j))
switch c.Type {
case commandReplyMsg:
ch := td.Chat{
ID: c.FromChatID64,
}
m := td.Message{
ID: int(c.FromMsgID64),
Chat: &ch,
}
r, err := b.Reply(&m, c.Text)
logOnError(err, "TGCmdWorker["+strconv.Itoa(id)+"] : Reply")
default:
}
}
log.Printf("TGCmdWorker[" + strconv.Itoa(id) + "] : Closing.")
}