diff --git a/workers.go b/workers.go index 20ae777..02a87b5 100644 --- a/workers.go +++ b/workers.go @@ -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.") }