test
This commit is contained in:
parent
599a5828ed
commit
377742825d
@ -609,6 +609,16 @@
|
||||
"name": "NY 2020 Event Battle Station",
|
||||
"obj_type": "msg"
|
||||
},
|
||||
{
|
||||
"intl_id": "msg_bot_craft_item",
|
||||
"name": "Craft check for specific item",
|
||||
"obj_type": "msg"
|
||||
},
|
||||
{
|
||||
"intl_id": "msg_bot_craft_all",
|
||||
"name": "Craft check for all items",
|
||||
"obj_type": "msg"
|
||||
},
|
||||
{
|
||||
"intl_id": "job_pillage",
|
||||
"name": "Pillage job",
|
||||
|
10
obj.go
10
obj.go
@ -34,11 +34,6 @@ func initCache(initDB bool) {
|
||||
err = loadObjSubType()
|
||||
logOnError(err, "initCache : caching obj_sub_type")
|
||||
|
||||
log.Println("Filling message parsing rules...")
|
||||
resetMsgParsingRules()
|
||||
msgParsingRules, err = loadMsgParsingRules()
|
||||
logOnError(err, "initCache : message parsing rules")
|
||||
|
||||
log.Println("Caching guilds ..")
|
||||
err = loadObjGuild()
|
||||
logOnError(err, "initCache : caching guilds")
|
||||
@ -51,6 +46,11 @@ func initCache(initDB bool) {
|
||||
err = loadObjItem()
|
||||
logOnError(err, "initCache : caching items")
|
||||
|
||||
log.Println("Filling message parsing rules...")
|
||||
resetMsgParsingRules()
|
||||
msgParsingRules, err = loadMsgParsingRules()
|
||||
logOnError(err, "initCache : message parsing rules")
|
||||
|
||||
log.Println("Caching messages ..")
|
||||
err = loadObjMsg()
|
||||
logOnError(err, "initCache : caching msgs")
|
||||
|
26
rules.go
26
rules.go
@ -39,6 +39,32 @@ func resetMsgParsingRules() error {
|
||||
}
|
||||
rules2 = append(rules2, r)
|
||||
|
||||
r = MessageParsingRule{
|
||||
Priority: 9999,
|
||||
Description: "All item craft",
|
||||
Rule: "^/craft_all$",
|
||||
MsgTypeID64: cacheObjSubType[`msg_bot_craft_all`],
|
||||
ChatID64: cfg.Bot.Mainchat,
|
||||
SenderUserID64: 0,
|
||||
}
|
||||
rules2 = append(rules2, r)
|
||||
|
||||
muxObjItem.RLock()
|
||||
defer muxObjItem.RUnlock()
|
||||
for _, o := range objItems {
|
||||
if o.Craft != nil {
|
||||
r = MessageParsingRule{
|
||||
Priority: 9998,
|
||||
Description: fmt.Sprintf("Specific item craft %s", o.Code),
|
||||
Rule: fmt.Sprintf("^%s$", o.Craft.Command),
|
||||
MsgTypeID64: cacheObjSubType[`msg_bot_craft_item`],
|
||||
ChatID64: cfg.Bot.Mainchat,
|
||||
SenderUserID64: 0,
|
||||
}
|
||||
rules2 = append(rules2, r)
|
||||
}
|
||||
}
|
||||
|
||||
r = MessageParsingRule{
|
||||
Priority: 1,
|
||||
Description: "Default Main chat",
|
||||
|
@ -508,6 +508,15 @@ func SQLIdentifyMsgWorker(id int, objIds <-chan int64) {
|
||||
case cacheObjSubType[`msg_job_gwithdraw_ack`]:
|
||||
_, err := parseSubTypeMessageJobGWithdrawAck(m, rule.re)
|
||||
logOnError(err, "SQLIdentifyMsgWorker["+strconv.Itoa(id)+"] : Parsing cacheObjSubType[`msg_quest_res`]")
|
||||
case cacheObjSubType[`msg_bot_craft_item`]:
|
||||
c := TGCommand{
|
||||
Type: commandReplyMsg,
|
||||
Text: `<b>test</b>`,
|
||||
FromMsgID64: m.ID64,
|
||||
FromChatID64: m.ChatID64,
|
||||
ParseMode: cmdParseModeHTML,
|
||||
}
|
||||
TGCmdQueue <- c
|
||||
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)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user