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