test
This commit is contained in:
parent
c3b0a88a9f
commit
a7a2fe3875
19
workers.go
19
workers.go
@ -180,9 +180,24 @@ func SQLJobWorker(id int) {
|
|||||||
func TGCmdWorker(id int, b *tb.Bot, cmds <-chan TGCommand) {
|
func TGCmdWorker(id int, b *tb.Bot, cmds <-chan TGCommand) {
|
||||||
log.Printf("TGCmdWorker[" + strconv.Itoa(id) + "] : Starting.")
|
log.Printf("TGCmdWorker[" + strconv.Itoa(id) + "] : Starting.")
|
||||||
for c := range cmds {
|
for c := range cmds {
|
||||||
b, err := json.Marshal(c)
|
j, err := json.Marshal(c)
|
||||||
logOnError(err, "TGCmdWorker["+strconv.Itoa(id)+"] : 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.")
|
log.Printf("TGCmdWorker[" + strconv.Itoa(id) + "] : Closing.")
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user