From 80329441604f4080f96aee343200adb5ce6883b5 Mon Sep 17 00:00:00 2001 From: shoopea Date: Mon, 21 Oct 2019 10:25:41 +0800 Subject: [PATCH] test forward from bottext --- bot.go | 22 ++++++++++++---------- workers.go | 2 +- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/bot.go b/bot.go index 5527bf7..31d9697 100644 --- a/bot.go +++ b/bot.go @@ -103,17 +103,19 @@ func botText(m *tb.Message) { b, _ := json.Marshal(m) log.Printf("botText : %s\n", string(b)) - /* - if (m.Chat.ID == cfg.Bot.Depositchat && int64(m.OriginalSender) == 408101137) { - cwm := ChatWarsMessage{ - TGUserID64: int64(m.Sender.ID), - TGSenderUserID64: int64(m.OriginalSender), - ID64: int64(m.ID), - ChatID64: updateMsg.Message.ChatID, - Text: txt, - } + if (m.Chat.ID == cfg.Bot.Depositchat || m.Chat.ID == cfg.Bot.Mainchat) && int64(m.OriginalSender) == chtwrsbotID64 { + cwm := ChatWarsMessage{ + TGUserID64: int64(m.Sender.ID), + TGSenderUserID64: chtwrsbotID64, + ID64: int64(m.ID), + ChatID64: int64(m.Chat.ID), + Text: m.Text, + Date: m.Time().UTC(), + IsForwarded: true, } - */ + MQCWMsgQueue <- cwm + + } // all the text messages that weren't // captured by existing handlers } diff --git a/workers.go b/workers.go index 0da6757..5594e95 100644 --- a/workers.go +++ b/workers.go @@ -387,7 +387,7 @@ func SQLIdentifyMsgWorker(id int, objIds <-chan int64) { _, err := parseSubTypeMessageQuestResultAmbush(m, rule.re) logOnError(err, "SQLIdentifyMsgWorker["+strconv.Itoa(id)+"] : Parsing objSubTypeMessageQuestResultAmbush.") if m.Date.Add(3 * time.Minute).After(time.Now().UTC()) { - if m.ChatID64 == chtwrsbotID64 { + if m.ChatID64 == chtwrsbotID64 && m.TGSenderUserID64 == chtwrsbotID64 { s := TGCommand{ Type: commandForwardMsg, FromUserID64: m.TGUserID64,