test user config
This commit is contained in:
parent
8c67f19066
commit
140b420652
11
bot.go
11
bot.go
@ -891,6 +891,17 @@ func botCraftItem(m *ChatWarsMessage, r *regexp.Regexp) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func botUserConfig(m *ChatWarsMessage) {
|
||||||
|
c := TGCommand{
|
||||||
|
Type: commandReplyMsg,
|
||||||
|
Text: "Config:",
|
||||||
|
FromMsgID64: m.ID64,
|
||||||
|
FromChatID64: m.ChatID64,
|
||||||
|
}
|
||||||
|
TGCmdQueue <- c
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
func botCraftAll(m *ChatWarsMessage, r *regexp.Regexp) {
|
func botCraftAll(m *ChatWarsMessage, r *regexp.Regexp) {
|
||||||
clt, err := getLockedIdleClient()
|
clt, err := getLockedIdleClient()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -654,6 +654,11 @@
|
|||||||
"name": "Get Stock",
|
"name": "Get Stock",
|
||||||
"obj_type": "msg"
|
"obj_type": "msg"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"intl_id": "msg_bot_user_config",
|
||||||
|
"name": "Get User Config in Bot",
|
||||||
|
"obj_type": "msg"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"intl_id": "job_pillage",
|
"intl_id": "job_pillage",
|
||||||
"name": "Pillage job",
|
"name": "Pillage job",
|
||||||
|
10
rules.go
10
rules.go
@ -40,6 +40,16 @@ func resetMsgParsingRules() error {
|
|||||||
if c.Active {
|
if c.Active {
|
||||||
chats = append(chats, id)
|
chats = append(chats, id)
|
||||||
users = append(users, id)
|
users = append(users, id)
|
||||||
|
|
||||||
|
r = MessageParsingRule{
|
||||||
|
Priority: 9999,
|
||||||
|
Description: "Config",
|
||||||
|
Rule: "^/config$",
|
||||||
|
MsgTypeID64: cacheObjSubType[`msg_bot_user_config`],
|
||||||
|
ChatID64: id,
|
||||||
|
SenderUserID64: id,
|
||||||
|
}
|
||||||
|
rules2 = append(rules2, r)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
muxClients.RUnlock()
|
muxClients.RUnlock()
|
||||||
|
@ -244,7 +244,7 @@ func MQKeepAliveWorker() {
|
|||||||
log.Printf("New client, reloading rules ..\n")
|
log.Printf("New client, reloading rules ..\n")
|
||||||
resetMsgParsingRules()
|
resetMsgParsingRules()
|
||||||
msgParsingRules, err = loadMsgParsingRules()
|
msgParsingRules, err = loadMsgParsingRules()
|
||||||
logOnError(err, "initCache : message parsing rules")
|
logOnError(err, "MQKeepAliveWorker : message parsing rules")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -542,6 +542,8 @@ func SQLIdentifyMsgWorker(id int, objIds <-chan int64) {
|
|||||||
logOnError(err, "SQLIdentifyMsgWorker["+strconv.Itoa(id)+"] : Parsing cacheObjSubType[`msg_shop_main_ack`]")
|
logOnError(err, "SQLIdentifyMsgWorker["+strconv.Itoa(id)+"] : Parsing cacheObjSubType[`msg_shop_main_ack`]")
|
||||||
err = insertMsgShopMainAck(cwm)
|
err = insertMsgShopMainAck(cwm)
|
||||||
logOnError(err, "SQLIdentifyMsgWorker["+strconv.Itoa(id)+"] : insertMsgShopMainAck")
|
logOnError(err, "SQLIdentifyMsgWorker["+strconv.Itoa(id)+"] : insertMsgShopMainAck")
|
||||||
|
case cacheObjSubType[`msg_bot_user_config`]:
|
||||||
|
botUserConfig(m)
|
||||||
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