This commit is contained in:
shoopea 2020-01-14 14:23:27 +08:00
parent f783985926
commit a87dc5e7f3

13
bot.go
View File

@ -106,7 +106,7 @@ func botQuery(q *tb.Query) {
func botText(m *tb.Message) { func botText(m *tb.Message) {
PrintText(m) PrintText(m)
if (m.Chat.ID == cfg.Bot.Depositchat || m.Chat.ID == cfg.Bot.Mainchat) && m.IsForwarded() && int64(m.OriginalSender.ID) == chtwrsbotID64 { if m.IsForwarded() && int64(m.OriginalSender.ID) == chtwrsbotID64 {
cwm := ChatWarsMessage{ cwm := ChatWarsMessage{
TGUserID64: int64(m.Sender.ID), TGUserID64: int64(m.Sender.ID),
TGSenderUserID64: chtwrsbotID64, TGSenderUserID64: chtwrsbotID64,
@ -117,6 +117,17 @@ func botText(m *tb.Message) {
IsForwarded: true, IsForwarded: true,
} }
MQCWMsgQueue <- cwm MQCWMsgQueue <- cwm
} else if (m.Chat.ID == cfg.Bot.Depositchat || m.Chat.ID == cfg.Bot.Mainchat) && !m.IsForwarded() {
cwm := ChatWarsMessage{
TGUserID64: int64(m.Sender.ID),
TGSenderUserID64: int64(m.Sender.ID),
ID64: int64(m.ID),
ChatID64: int64(m.Chat.ID),
Text: m.Text,
Date: m.Time().UTC(),
IsForwarded: false,
}
MQCWMsgQueue <- cwm
} }
// all the text messages that weren't // all the text messages that weren't
// captured by existing handlers // captured by existing handlers