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 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) { func botUserConfig(m *ChatWarsMessage) {
clt, _ := getLockedClient(m.TGUserID64, false) clt, _ := getLockedClient(m.TGUserID64, false)
clt.Mux.Unlock() clt.Mux.Unlock()

View File

@ -674,6 +674,16 @@
"name": "Set User Config Pillage OFF", "name": "Set User Config Pillage OFF",
"obj_type": "msg" "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", "intl_id": "msg_unknown_action",
"name": "Set Unknown Action", "name": "Set Unknown Action",

View File

@ -81,6 +81,26 @@ func resetMsgParsingRules() error {
} }
rules2 = append(rules2, r) 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{ r = MessageParsingRule{
Priority: 9999, Priority: 9999,
Description: "Alch your supply", Description: "Alch your supply",

View File

@ -548,6 +548,10 @@ func SQLIdentifyMsgWorker(id int, objIds <-chan int64) {
botUserConfigPillage(m, true) botUserConfigPillage(m, true)
case cacheObjSubType[`msg_bot_user_config_pillage_off`]: case cacheObjSubType[`msg_bot_user_config_pillage_off`]:
botUserConfigPillage(m, false) 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`]: case cacheObjSubType[`msg_bot_shutdown`]:
botShutdown() botShutdown()
case cacheObjSubType[`msg_bot_rage_up`]: case cacheObjSubType[`msg_bot_rage_up`]: