test pillage set
This commit is contained in:
parent
2bd918a431
commit
74bfb46217
8
bot.go
8
bot.go
@ -891,6 +891,14 @@ func botCraftItem(m *ChatWarsMessage, r *regexp.Regexp) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func botUserConfigPillage(m *ChatWarsMessage, set bool) {
|
||||||
|
clt, _ := getLockedClient(m.TGUserID64, false)
|
||||||
|
clt.Config.InterceptPillage = set
|
||||||
|
clt.Mux.Unlock()
|
||||||
|
botUserConfig(m)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
func botUserConfig(m *ChatWarsMessage) {
|
func botUserConfig(m *ChatWarsMessage) {
|
||||||
clt, _ := getLockedClient(m.TGUserID64, false)
|
clt, _ := getLockedClient(m.TGUserID64, false)
|
||||||
clt.Mux.Unlock()
|
clt.Mux.Unlock()
|
||||||
|
@ -659,6 +659,16 @@
|
|||||||
"name": "Get User Config in Bot",
|
"name": "Get User Config in Bot",
|
||||||
"obj_type": "msg"
|
"obj_type": "msg"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"intl_id": "msg_bot_user_config_pillage_on",
|
||||||
|
"name": "Set User Config Pillage ON",
|
||||||
|
"obj_type": "msg"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"intl_id": "msg_bot_user_config_pillage_off",
|
||||||
|
"name": "Set User Config Pillage OFF",
|
||||||
|
"obj_type": "msg"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"intl_id": "job_pillage",
|
"intl_id": "job_pillage",
|
||||||
"name": "Pillage job",
|
"name": "Pillage job",
|
||||||
|
20
rules.go
20
rules.go
@ -50,6 +50,26 @@ func resetMsgParsingRules() error {
|
|||||||
SenderUserID64: id,
|
SenderUserID64: id,
|
||||||
}
|
}
|
||||||
rules2 = append(rules2, r)
|
rules2 = append(rules2, r)
|
||||||
|
|
||||||
|
r = MessageParsingRule{
|
||||||
|
Priority: 9999,
|
||||||
|
Description: "Config",
|
||||||
|
Rule: "^/config_pillage_on$",
|
||||||
|
MsgTypeID64: cacheObjSubType[`msg_bot_user_config_pillage_on`],
|
||||||
|
ChatID64: id,
|
||||||
|
SenderUserID64: id,
|
||||||
|
}
|
||||||
|
rules2 = append(rules2, r)
|
||||||
|
|
||||||
|
r = MessageParsingRule{
|
||||||
|
Priority: 9999,
|
||||||
|
Description: "Config",
|
||||||
|
Rule: "^/config_pillage_off$",
|
||||||
|
MsgTypeID64: cacheObjSubType[`msg_bot_user_config_pillage_off`],
|
||||||
|
ChatID64: id,
|
||||||
|
SenderUserID64: id,
|
||||||
|
}
|
||||||
|
rules2 = append(rules2, r)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
muxClients.RUnlock()
|
muxClients.RUnlock()
|
||||||
|
@ -544,6 +544,10 @@ func SQLIdentifyMsgWorker(id int, objIds <-chan int64) {
|
|||||||
logOnError(err, "SQLIdentifyMsgWorker["+strconv.Itoa(id)+"] : insertMsgShopMainAck")
|
logOnError(err, "SQLIdentifyMsgWorker["+strconv.Itoa(id)+"] : insertMsgShopMainAck")
|
||||||
case cacheObjSubType[`msg_bot_user_config`]:
|
case cacheObjSubType[`msg_bot_user_config`]:
|
||||||
botUserConfig(m)
|
botUserConfig(m)
|
||||||
|
case cacheObjSubType[`msg_bot_user_config_pillage_on`]:
|
||||||
|
botUserConfigPillage(m, true)
|
||||||
|
case cacheObjSubType[`msg_bot_user_config_pillage_off`]:
|
||||||
|
botUserConfigPillage(m, false)
|
||||||
default:
|
default:
|
||||||
//log.Printf("SQLIdentifyMsgWorker["+strconv.Itoa(id)+"] : Unknwon message type in rule %d : %d (%d)\n%s\n", msgParsingRules[i].ID, msgParsingRules[i].MsgTypeID64, objId, m.Text)
|
//log.Printf("SQLIdentifyMsgWorker["+strconv.Itoa(id)+"] : Unknwon message type in rule %d : %d (%d)\n%s\n", msgParsingRules[i].ID, msgParsingRules[i].MsgTypeID64, objId, m.Text)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user