diff --git a/bot.go b/bot.go index 6483118..fe53a92 100644 --- a/bot.go +++ b/bot.go @@ -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() diff --git a/data/code_obj_sub_type.json b/data/code_obj_sub_type.json index 4d74efd..f11a07a 100644 --- a/data/code_obj_sub_type.json +++ b/data/code_obj_sub_type.json @@ -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", diff --git a/rules.go b/rules.go index 3a4b407..9b90fef 100644 --- a/rules.go +++ b/rules.go @@ -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", diff --git a/workers.go b/workers.go index c048e1f..a6eca6b 100644 --- a/workers.go +++ b/workers.go @@ -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`]: