update parsing rules

This commit is contained in:
shoopea 2020-02-29 16:57:09 +08:00
parent c5518bae89
commit 5c81d83064
2 changed files with 32 additions and 27 deletions

View File

@ -474,7 +474,7 @@
{ {
"prio": 5000, "prio": 5000,
"descn": "Guild roles Req", "descn": "Guild roles Req",
"rule": "^Roles:\\nBartender:\\n((⚗️|⚔️|⚒|🛡|📦)(?P<Bartender>.*)|.*[unassigned].*)\\n\\n\\nCommander:\\n((⚗️|⚔️|⚒|🛡|📦)(?P<Commander>.*)|.*[unassigned].*)\\n\\n\\nSquire:\\n((⚗️|⚔️|⚒|🛡|📦)(?P<Squire>.*)|.*[unassigned].*)\\n\\n\\nTreasurer:\\n((⚗️|⚔️|⚒|🛡|📦)(?P<Treasurer>.*)|.*[unassigned].*)$", "rule": "^Roles:\\nBartender:\\n((⚗️|⚔️|⚒|🛡|📦)(?P<Bartender>.*)|.*\\[unassigned\\].*)\\n\\n\\nCommander:\\n((⚗️|⚔️|⚒|🛡|📦)(?P<Commander>.*)|.*\\[unassigned\\].*)\\n\\n\\nSquire:\\n((⚗️|⚔️|⚒|🛡|📦)(?P<Squire>.*)|.*\\[unassigned\\].*)\\n\\n\\nTreasurer:\\n((⚗️|⚔️|⚒|🛡|📦)(?P<Treasurer>.*)|.*\\[unassigned\\].*)$",
"msg_type": "msg_groles_ack", "msg_type": "msg_groles_ack",
"chat_id": 0, "chat_id": 0,
"user_id": 0 "user_id": 0
@ -490,7 +490,7 @@
{ {
"prio": 5000, "prio": 5000,
"descn": "Alch stock Ack", "descn": "Alch stock Ack",
"rule": "^📦Your stock:(?P<Stuff>(\\n/aa_[0-9]{2} [a-zA-Z ]+ x [0-9]+)+)$", "rule": "^📦Your stock:(?P<Stuff>(\\n\\/aa_[0-9]{2} [a-zA-Z ']+ x [0-9]+)+)$",
"msg_type": "msg_alch_stock_ack", "msg_type": "msg_alch_stock_ack",
"chat_id": 0, "chat_id": 0,
"user_id": 0 "user_id": 0
@ -498,7 +498,7 @@
{ {
"prio": 5000, "prio": 5000,
"descn": "Skill too low", "descn": "Skill too low",
"rule": "^[Skill level too low]$", "rule": "^\\[Skill level too low\\]$",
"msg_type": "msg_skill_too_low", "msg_type": "msg_skill_too_low",
"chat_id": 0, "chat_id": 0,
"user_id": 0 "user_id": 0

15
msg.go
View File

@ -394,7 +394,10 @@ func parseSubTypeMessageShopMainAck(m *ChatWarsMessage, r *regexp.Regexp) (*Chat
} }
func parseSubTypeMessageMeAck(m *ChatWarsMessage, r *regexp.Regexp) (*ChatWarsMessageMeAck, error) { func parseSubTypeMessageMeAck(m *ChatWarsMessage, r *regexp.Regexp) (*ChatWarsMessageMeAck, error) {
var i int64 var (
i int64
err error
)
cwm := ChatWarsMessageMeAck{ cwm := ChatWarsMessageMeAck{
CWUserID64: getObjUserID(r.ReplaceAllString(m.Text, "${Player}")), CWUserID64: getObjUserID(r.ReplaceAllString(m.Text, "${Player}")),
@ -409,12 +412,14 @@ func parseSubTypeMessageMeAck(m *ChatWarsMessage, r *regexp.Regexp) (*ChatWarsMe
i, _ = strconv.ParseInt(r.ReplaceAllString(m.Text, "${Level}"), 10, 64) i, _ = strconv.ParseInt(r.ReplaceAllString(m.Text, "${Level}"), 10, 64)
cwm.Level = i cwm.Level = i
i, _ = strconv.ParseInt(r.ReplaceAllString(m.Text, "${ManaNow}"), 10, 64) i, err = strconv.ParseInt(r.ReplaceAllString(m.Text, "${ManaNow}"), 10, 64)
logOnError(err, "parseSubTypeMessageMeAck : ParseInt(ManaNow)")
cwm.ManaNow = i cwm.ManaNow = i
i, _ = strconv.ParseInt(r.ReplaceAllString(m.Text, "${ManaMax}"), 10, 64) i, err = strconv.ParseInt(r.ReplaceAllString(m.Text, "${ManaMax}"), 10, 64)
logOnError(err, "parseSubTypeMessageMeAck : ParseInt(ManaMax)")
cwm.ManaMax = i cwm.ManaMax = i
/*
log.Printf("parseSubTypeMessageMeAck : Me report identified\n") log.Printf("parseSubTypeMessageMeAck : Me report identified\n")
log.Printf("parseSubTypeMessageMeAck : Castle : %s\n", r.ReplaceAllString(m.Text, "${Castle}")) log.Printf("parseSubTypeMessageMeAck : Castle : %s\n", r.ReplaceAllString(m.Text, "${Castle}"))
log.Printf("parseSubTypeMessageMeAck : Level : %s\n", r.ReplaceAllString(m.Text, "${Level}")) log.Printf("parseSubTypeMessageMeAck : Level : %s\n", r.ReplaceAllString(m.Text, "${Level}"))
@ -434,7 +439,7 @@ func parseSubTypeMessageMeAck(m *ChatWarsMessage, r *regexp.Regexp) (*ChatWarsMe
log.Printf("parseSubTypeMessageMeAck : DefGear : %s\n", r.ReplaceAllString(m.Text, "${DefGear}")) log.Printf("parseSubTypeMessageMeAck : DefGear : %s\n", r.ReplaceAllString(m.Text, "${DefGear}"))
log.Printf("parseSubTypeMessageMeAck : BagUsed : %s\n", r.ReplaceAllString(m.Text, "${BagUsed}")) log.Printf("parseSubTypeMessageMeAck : BagUsed : %s\n", r.ReplaceAllString(m.Text, "${BagUsed}"))
log.Printf("parseSubTypeMessageMeAck : BagDispo : %s\n", r.ReplaceAllString(m.Text, "${BagDispo}")) log.Printf("parseSubTypeMessageMeAck : BagDispo : %s\n", r.ReplaceAllString(m.Text, "${BagDispo}"))
*/
cwm.Msg = m cwm.Msg = m
return &cwm, nil return &cwm, nil
} }