This commit is contained in:
shoopea 2020-06-17 12:15:54 +02:00
parent 7f2fb9936e
commit 2bd7967122
4 changed files with 42 additions and 0 deletions

8
bot.go
View File

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

View File

@ -684,6 +684,16 @@
"name": "Set User Config DEF CASTLE",
"obj_type": "msg"
},
{
"intl_id": "msg_bot_user_config_deposit_on",
"name": "Set User Config DEPOSIT ON",
"obj_type": "msg"
},
{
"intl_id": "msg_bot_user_config_deposit_off",
"name": "Set User Config DEPOSIT OFF",
"obj_type": "msg"
},
{
"intl_id": "msg_unknown_action",
"name": "Set Unknown Action",

View File

@ -110,6 +110,26 @@ func resetMsgParsingRules() error {
SenderUserID64: id,
}
rules2 = append(rules2, r)
r = MessageParsingRule{
Priority: 9999,
Description: "Turn auto deposit on",
Rule: "^/config_deposit_on$",
MsgTypeID64: cacheObjSubType[`msg_bot_user_config_deposit_on`],
ChatID64: id,
SenderUserID64: id,
}
rules2 = append(rules2, r)
r = MessageParsingRule{
Priority: 9999,
Description: "Turn auto deposit off",
Rule: "^/config_deposit_on$",
MsgTypeID64: cacheObjSubType[`msg_bot_user_config_deposit_off`],
ChatID64: id,
SenderUserID64: id,
}
rules2 = append(rules2, r)
}
}
muxClients.RUnlock()

View File

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