test
This commit is contained in:
parent
f9bad07956
commit
898901b9d1
10
msg.go
10
msg.go
@ -176,10 +176,18 @@ func parseSubTypeMessageStockAck(m *ChatWarsMessage, r *regexp.Regexp) (*ChatWar
|
||||
func parseSubTypeMessageReportAck(m *ChatWarsMessage, r *regexp.Regexp) (*ChatWarsMessageReportAck, error) {
|
||||
cwm := ChatWarsMessageReportAck{}
|
||||
log.Printf("parseSubTypeMessageReport : Extra : %s\n", r.ReplaceAllString(m.Text, "${Extra}"))
|
||||
re := regexp.MustCompile(`(.+)`)
|
||||
re := regexp.MustCompile(`((?P<Cry>Your battle cries were successful)|(You were outplayed by (?P<Outplayer>.*))|(?P<Stamina>🔋Stamina restored)|.+)`)
|
||||
for i, l := range re.FindAllStringSubmatch(r.ReplaceAllString(m.Text, "${Extra}"), -1) {
|
||||
if re.ReplaceAllString(l[0], "${Cry}") != nil {
|
||||
log.Printf("parseSubTypeMessageReport : Extra[%d] : Cry\n", i)
|
||||
} else if re.ReplaceAllString(l[0], "${Outplayer}") != nil {
|
||||
log.Printf("parseSubTypeMessageReport : Extra[%d] : Outplayer\n", i)
|
||||
} else if re.ReplaceAllString(l[0], "${Stamina}") != nil {
|
||||
log.Printf("parseSubTypeMessageReport : Extra[%d] : Stamina\n", i)
|
||||
} else {
|
||||
log.Printf("parseSubTypeMessageReport : Extra[%d] : %s\n", i, l[0])
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
log.Printf("parseSubTypeMessageReport : War report identified\n")
|
||||
|
Loading…
Reference in New Issue
Block a user