update config functions

This commit is contained in:
shoopea 2020-04-07 10:40:53 +08:00
parent 950605b129
commit ebd3baef1f
4 changed files with 42 additions and 0 deletions

8
bot.go
View File

@ -914,6 +914,14 @@ func botUserConfigPillage(m *ChatWarsMessage, set bool) {
return
}
func botUserConfigWartime(m *ChatWarsMessage, set string) {
clt, _ := getLockedClient(m.TGUserID64, false)
clt.Config.Wartime = set
clt.Mux.Unlock()
botUserConfig(m)
return
}
func botUserConfig(m *ChatWarsMessage) {
clt, _ := getLockedClient(m.TGUserID64, false)
clt.Mux.Unlock()

View File

@ -674,6 +674,16 @@
"name": "Set User Config Pillage OFF",
"obj_type": "msg"
},
{
"intl_id": "msg_bot_user_config_def_guild",
"name": "Set User Config DEF GUILD",
"obj_type": "msg"
},
{
"intl_id": "msg_bot_user_config_def_castle",
"name": "Set User Config DEF CASTLE",
"obj_type": "msg"
},
{
"intl_id": "msg_unknown_action",
"name": "Set Unknown Action",

View File

@ -81,6 +81,26 @@ func resetMsgParsingRules() error {
}
rules2 = append(rules2, r)
r = MessageParsingRule{
Priority: 9999,
Description: "Config",
Rule: "^/config_def_guild$",
MsgTypeID64: cacheObjSubType[`msg_bot_user_config_def_guild`],
ChatID64: id,
SenderUserID64: id,
}
rules2 = append(rules2, r)
r = MessageParsingRule{
Priority: 9999,
Description: "Config",
Rule: "^/config_def_castle$",
MsgTypeID64: cacheObjSubType[`msg_bot_user_config_def_castle`],
ChatID64: id,
SenderUserID64: id,
}
rules2 = append(rules2, r)
r = MessageParsingRule{
Priority: 9999,
Description: "Alch your supply",

View File

@ -548,6 +548,10 @@ func SQLIdentifyMsgWorker(id int, objIds <-chan int64) {
botUserConfigPillage(m, true)
case cacheObjSubType[`msg_bot_user_config_pillage_off`]:
botUserConfigPillage(m, false)
case cacheObjSubType[`msg_bot_user_config_def_guild`]:
botUserConfigWartime(m, `/g_def`)
case cacheObjSubType[`msg_bot_user_config_def_castle`]:
botUserConfigWartime(m, `🛡Defend`)
case cacheObjSubType[`msg_bot_shutdown`]:
botShutdown()
case cacheObjSubType[`msg_bot_rage_up`]: