This commit is contained in:
shoopea 2020-02-03 12:14:02 +08:00
parent 784d2f89bf
commit f8049c25c2
2 changed files with 7 additions and 7 deletions

View File

@ -1866,7 +1866,7 @@
{
"prio": 5000,
"descn": "Tributes stats ack",
"rule": "^([1-9]{2} [a-zA-Z]+ [0-9]{4} [0-9]{2}\\:[0-9]{2} - [a-zA-Z]+ x [0-9]+, [0-9]+🔥(\n){0,1})+$",
"rule": "^(Here is the list of recent villagers tribute\\:)(?P<Tributes>\\n([1-9]{2} [a-zA-Z]+ [0-9]{4} [0-9]{2}\\:[0-9]{2} - [a-zA-Z]+ x [0-9]+, [0-9]+🔥)+$",
"msg_type": "msg_tributes_stats_req",
"chat_id": 0,
"user_id": 0

12
msg.go
View File

@ -278,12 +278,12 @@ func parseSubTypeMessageGStockAnyAck(m *ChatWarsMessage, r *regexp.Regexp) (*Cha
func parseSubTypeMessageTributesStatsAck(m *ChatWarsMessage, r *regexp.Regexp) (*ChatWarsMessageTributesStatsAck, error) {
cwm := ChatWarsMessageTributesStatsAck{}
tribute := ChatWarsTribute{}
re := regexp.MustCompile(`((?P<Date>[1-9]{2} [a-zA-Z]+ [0-9]{4} [0-9]{2}:[0-9]{2}) - (?P<Item>[a-zA-Z]+) x (?P<Quantity>[0-9]+), (?P<Exp>[0-9]+)🔥(\n){0,1})`)
for _, l := range re.FindAllStringSubmatch(m.Text, -1) {
log.Printf("parseSubTypeMessageTributesStatsAck : Date : %s\n", r.ReplaceAllString(l[0], "${Date}"))
log.Printf("parseSubTypeMessageTributesStatsAck : Item : %s\n", r.ReplaceAllString(l[0], "${Item}"))
log.Printf("parseSubTypeMessageTributesStatsAck : Quantity : %s\n", r.ReplaceAllString(l[0], "${Quantity}"))
log.Printf("parseSubTypeMessageTributesStatsAck : Exp : %s\n", r.ReplaceAllString(l[0], "${Exp}"))
re := regexp.MustCompile(`(\n(?P<Date>[1-9]{2} [a-zA-Z]+ [0-9]{4} [0-9]{2}:[0-9]{2}) - (?P<Item>[a-zA-Z]+) x (?P<Quantity>[0-9]+), (?P<Exp>[0-9]+)🔥)`)
for _, l := range re.FindAllStringSubmatch(r.ReplaceAllString(m.Text, "${Tributes}"), -1) {
log.Printf("parseSubTypeMessageTributesStatsAck : Date : %s\n", re.ReplaceAllString(l[0], "${Date}"))
log.Printf("parseSubTypeMessageTributesStatsAck : Item : %s\n", re.ReplaceAllString(l[0], "${Item}"))
log.Printf("parseSubTypeMessageTributesStatsAck : Quantity : %s\n", re.ReplaceAllString(l[0], "${Quantity}"))
log.Printf("parseSubTypeMessageTributesStatsAck : Exp : %s\n", re.ReplaceAllString(l[0], "${Exp}"))
cwm.Tributes = append(cwm.Tributes, tribute)
}