diff --git a/data/msg_rules.json b/data/msg_rules.json index b065f04..62dd86b 100644 --- a/data/msg_rules.json +++ b/data/msg_rules.json @@ -474,7 +474,7 @@ { "prio": 5000, "descn": "Guild roles Req", - "rule": "^Roles:\\nBartender:\\n((⚗️|⚔️|⚒|🛡|📦)(?P.*)|.*[unassigned].*)\\n\\n\\nCommander:\\n((⚗️|⚔️|⚒|🛡|📦)(?P.*)|.*[unassigned].*)\\n\\n\\nSquire:\\n((⚗️|⚔️|⚒|🛡|📦)(?P.*)|.*[unassigned].*)\\n\\n\\nTreasurer:\\n((⚗️|⚔️|⚒|🛡|📦)(?P.*)|.*[unassigned].*)$", + "rule": "^Roles:\\nBartender:\\n((⚗️|⚔️|⚒|🛡|📦)(?P.*)|.*\\[unassigned\\].*)\\n\\n\\nCommander:\\n((⚗️|⚔️|⚒|🛡|📦)(?P.*)|.*\\[unassigned\\].*)\\n\\n\\nSquire:\\n((⚗️|⚔️|⚒|🛡|📦)(?P.*)|.*\\[unassigned\\].*)\\n\\n\\nTreasurer:\\n((⚗️|⚔️|⚒|🛡|📦)(?P.*)|.*\\[unassigned\\].*)$", "msg_type": "msg_groles_ack", "chat_id": 0, "user_id": 0 @@ -490,7 +490,7 @@ { "prio": 5000, "descn": "Alch stock Ack", - "rule": "^📦Your stock:(?P(\\n/aa_[0-9]{2} [a-zA-Z ]+ x [0-9]+)+)$", + "rule": "^📦Your stock:(?P(\\n\\/aa_[0-9]{2} [a-zA-Z ']+ x [0-9]+)+)$", "msg_type": "msg_alch_stock_ack", "chat_id": 0, "user_id": 0 @@ -498,7 +498,7 @@ { "prio": 5000, "descn": "Skill too low", - "rule": "^[Skill level too low]$", + "rule": "^\\[Skill level too low\\]$", "msg_type": "msg_skill_too_low", "chat_id": 0, "user_id": 0 diff --git a/msg.go b/msg.go index 520354c..5bac314 100644 --- a/msg.go +++ b/msg.go @@ -394,7 +394,10 @@ func parseSubTypeMessageShopMainAck(m *ChatWarsMessage, r *regexp.Regexp) (*Chat } func parseSubTypeMessageMeAck(m *ChatWarsMessage, r *regexp.Regexp) (*ChatWarsMessageMeAck, error) { - var i int64 + var ( + i int64 + err error + ) cwm := ChatWarsMessageMeAck{ CWUserID64: getObjUserID(r.ReplaceAllString(m.Text, "${Player}")), @@ -409,32 +412,34 @@ func parseSubTypeMessageMeAck(m *ChatWarsMessage, r *regexp.Regexp) (*ChatWarsMe i, _ = strconv.ParseInt(r.ReplaceAllString(m.Text, "${Level}"), 10, 64) 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 - 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 - - log.Printf("parseSubTypeMessageMeAck : Me report identified\n") - 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 : Class : %s\n", cwm.Class) - log.Printf("parseSubTypeMessageMeAck : Atk : %s\n", r.ReplaceAllString(m.Text, "${Atk}")) - log.Printf("parseSubTypeMessageMeAck : Def : %s\n", r.ReplaceAllString(m.Text, "${Def}")) - log.Printf("parseSubTypeMessageMeAck : ExpNow : %s\n", r.ReplaceAllString(m.Text, "${ExpNow}")) - log.Printf("parseSubTypeMessageMeAck : ExpLvl : %s\n", r.ReplaceAllString(m.Text, "${ExpLvl}")) - log.Printf("parseSubTypeMessageMeAck : StaminaNow : %s\n", r.ReplaceAllString(m.Text, "${StaminaNow}")) - log.Printf("parseSubTypeMessageMeAck : StaminaMax : %s\n", r.ReplaceAllString(m.Text, "${StaminaMax}")) - log.Printf("parseSubTypeMessageMeAck : ManaNow : %s\n", r.ReplaceAllString(m.Text, "${ManaNow}")) - log.Printf("parseSubTypeMessageMeAck : ManaMax : %s\n", r.ReplaceAllString(m.Text, "${ManaMax}")) - log.Printf("parseSubTypeMessageMeAck : Gold : %s\n", r.ReplaceAllString(m.Text, "${Gold}")) - log.Printf("parseSubTypeMessageMeAck : Pogs : %s\n", r.ReplaceAllString(m.Text, "${Pogs}")) - log.Printf("parseSubTypeMessageMeAck : Gems : %s\n", r.ReplaceAllString(m.Text, "${Gems}")) - log.Printf("parseSubTypeMessageMeAck : AtkGear : %s\n", r.ReplaceAllString(m.Text, "${AtkGear}")) - 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 : BagDispo : %s\n", r.ReplaceAllString(m.Text, "${BagDispo}")) - + /* + log.Printf("parseSubTypeMessageMeAck : Me report identified\n") + 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 : Class : %s\n", cwm.Class) + log.Printf("parseSubTypeMessageMeAck : Atk : %s\n", r.ReplaceAllString(m.Text, "${Atk}")) + log.Printf("parseSubTypeMessageMeAck : Def : %s\n", r.ReplaceAllString(m.Text, "${Def}")) + log.Printf("parseSubTypeMessageMeAck : ExpNow : %s\n", r.ReplaceAllString(m.Text, "${ExpNow}")) + log.Printf("parseSubTypeMessageMeAck : ExpLvl : %s\n", r.ReplaceAllString(m.Text, "${ExpLvl}")) + log.Printf("parseSubTypeMessageMeAck : StaminaNow : %s\n", r.ReplaceAllString(m.Text, "${StaminaNow}")) + log.Printf("parseSubTypeMessageMeAck : StaminaMax : %s\n", r.ReplaceAllString(m.Text, "${StaminaMax}")) + log.Printf("parseSubTypeMessageMeAck : ManaNow : %s\n", r.ReplaceAllString(m.Text, "${ManaNow}")) + log.Printf("parseSubTypeMessageMeAck : ManaMax : %s\n", r.ReplaceAllString(m.Text, "${ManaMax}")) + log.Printf("parseSubTypeMessageMeAck : Gold : %s\n", r.ReplaceAllString(m.Text, "${Gold}")) + log.Printf("parseSubTypeMessageMeAck : Pogs : %s\n", r.ReplaceAllString(m.Text, "${Pogs}")) + log.Printf("parseSubTypeMessageMeAck : Gems : %s\n", r.ReplaceAllString(m.Text, "${Gems}")) + log.Printf("parseSubTypeMessageMeAck : AtkGear : %s\n", r.ReplaceAllString(m.Text, "${AtkGear}")) + 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 : BagDispo : %s\n", r.ReplaceAllString(m.Text, "${BagDispo}")) + */ cwm.Msg = m return &cwm, nil }