From 5d3e480a54b25321dd36c4beebc2e536d38039d6 Mon Sep 17 00:00:00 2001 From: shoopea Date: Fri, 17 May 2019 15:20:50 +0800 Subject: [PATCH] test --- workers.go | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/workers.go b/workers.go index afe2f82..ae7ee7b 100644 --- a/workers.go +++ b/workers.go @@ -127,7 +127,7 @@ func SQLIdentifyMsgWorker(id int, objIds <-chan int64) { s := TGCommand{ Type: commandSendMsg, Text: fmt.Sprintf("Catching pillage (%s)", m.Date.Format(time.RFC3339)), - ToChatID64: m.UserID64, + ToUserID64: m.UserID64, } TGCmdQueue <- s case objSubTypeMessageGo: @@ -206,6 +206,20 @@ func TGCmdWorker(id int, b *tb.Bot, cmds <-chan TGCommand) { } _, err := b.Reply(&m, c.Text) logOnError(err, "TGCmdWorker["+strconv.Itoa(id)+"] : Reply") + case commandSendMsg: + if c.ToChatID64 != 0 { + ch := tb.Chat{ + ID: c.ToChatID64, + } + _, err := b.Send(&ch, c.Text) + logOnError(err, "TGCmdWorker["+strconv.Itoa(id)+"] : Send") + } else if c.ToUserID64 != 0 { + ch := tb.Chat{ + ID: c.ToUserID64, + } + _, err := b.Send(&ch, c.Text) + logOnError(err, "TGCmdWorker["+strconv.Itoa(id)+"] : Send") + } default: } @@ -271,7 +285,7 @@ func MQKeepAliveWorker() { clientsQueues[x.UserID64] = &x c := TGCommand{ Type: commandSendMsg, - ToChatID64: x.UserID64, + ToUserID64: x.UserID64, Text: "You are connected.", } TGCmdQueue <- c @@ -291,7 +305,7 @@ func MQTidyKeepAliveWorker() { if v.Date.Add(90 * time.Second).Before(time.Now()) { c := TGCommand{ Type: commandSendMsg, - ToChatID64: v.UserID64, + ToUserID64: v.UserID64, Text: "Timeout.", } TGCmdQueue <- c