update ambush dynamic reaction

This commit is contained in:
shoopea 2019-10-21 14:45:47 +08:00
parent c4dd261b78
commit fbfdbf22f8
4 changed files with 23 additions and 4 deletions

View File

@ -1,4 +1,5 @@
ChirpNestBot ChirpNestBot
- [ ] Remove duplicate messages from external channels where there was client+bot feed
- [ ] Identify TG user_id - [ ] Identify TG user_id
- [ ] Add autobid option for auctions - [ ] Add autobid option for auctions
- [ ] Check for not launching concurrent msg rescan jobs - [ ] Check for not launching concurrent msg rescan jobs
@ -23,7 +24,7 @@ ChirpNestBot
- [ ] Vault valuation - [ ] Vault valuation
- [ ] Experience graphs & forecast - [ ] Experience graphs & forecast
- [ ] Impersonate - [ ] Impersonate
- [ ] Link TelegramUserID and UserID - [ ] Link TelegramUserID and UserID (can use historic auction messages)
- [ ] Issue with Squire in the /g_roles ? - [ ] Issue with Squire in the /g_roles ?
- [x] Foray interception - [x] Foray interception
- [ ] Handle Foray timeout to stop spamming in case something goes bad - [ ] Handle Foray timeout to stop spamming in case something goes bad

5
bot.go
View File

@ -100,8 +100,6 @@ func botQuery(q *tb.Query) {
func botText(m *tb.Message) { func botText(m *tb.Message) {
PrintText(m) PrintText(m)
b, _ := json.Marshal(m)
log.Printf("botText : %s\n", string(b))
if (m.Chat.ID == cfg.Bot.Depositchat || m.Chat.ID == cfg.Bot.Mainchat) && int64(m.OriginalSender.ID) == chtwrsbotID64 { if (m.Chat.ID == cfg.Bot.Depositchat || m.Chat.ID == cfg.Bot.Mainchat) && int64(m.OriginalSender.ID) == chtwrsbotID64 {
cwm := ChatWarsMessage{ cwm := ChatWarsMessage{
@ -115,6 +113,9 @@ func botText(m *tb.Message) {
} }
MQCWMsgQueue <- cwm MQCWMsgQueue <- cwm
} else {
b, _ := json.Marshal(m)
log.Printf("botText : %s\n", string(b))
} }
// all the text messages that weren't // all the text messages that weren't
// captured by existing handlers // captured by existing handlers

View File

@ -127,3 +127,19 @@ func clientGetCWUserID64(tgUserID64 int64) (int64, error) {
} }
return 0, errors.New("Unknown user_id.") return 0, errors.New("Unknown user_id.")
} }
func clientSpreadQuestResultAmbush(cwm ChatWarsMessageQuestResultAmbush) error {
/*
muxClients.RLock()
var ret string
for id, c := range clients {
if c.Active {
ret = fmt.Sprintf("%s%s | UserID : %d | TelegramID : %d (online)\n", ret, c.Login, c.CWUserID64, id)
} else {
ret = fmt.Sprintf("%s%s | UserID : %d | TelegramID : %d (offline)\n", ret, c.Login, c.CWUserID64, id)
}
}
muxClients.RUnlock()
*/
return nil
}

View File

@ -397,7 +397,8 @@ func SQLIdentifyMsgWorker(id int, objIds <-chan int64) {
} }
MQTGCmdQueue <- s MQTGCmdQueue <- s
} else if m.ChatID64 == cfg.Bot.Mainchat { } else if m.ChatID64 == cfg.Bot.Mainchat {
err = clientSpreadQuestResultAmbush(cwm)
logOnError(err, "SQLIdentifyMsgWorker["+strconv.Itoa(id)+"] : clientSpreadQuestResultAmbush.")
} }
} }
case objSubTypeMessagePillageInc: case objSubTypeMessagePillageInc: