test
This commit is contained in:
parent
6178e92c51
commit
e43e9365b8
4
msg.go
4
msg.go
@ -277,6 +277,8 @@ func parseSubTypeMessageGStockAnyAck(m *ChatWarsMessage, r *regexp.Regexp) (*Cha
|
||||
|
||||
func parseSubTypeMessageTributesStatsAck(m *ChatWarsMessage, r *regexp.Regexp) (*ChatWarsMessageTributesStatsAck, error) {
|
||||
cwm := ChatWarsMessageTributesStatsAck{}
|
||||
cwm.Msg = m
|
||||
|
||||
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) {
|
||||
tribute := ChatWarsTribute{}
|
||||
@ -291,9 +293,9 @@ func parseSubTypeMessageTributesStatsAck(m *ChatWarsMessage, r *regexp.Regexp) (
|
||||
tribute.Quantity, _ = strconv.ParseInt(r.ReplaceAllString(l[0], "${Quantity}"), 10, 64)
|
||||
tribute.Exp, _ = strconv.ParseInt(r.ReplaceAllString(l[0], "${Exp}"), 10, 64)
|
||||
cwm.Tributes = append(cwm.Tributes, tribute)
|
||||
log.Printf("parseSubTypeMessageTributesStatsAck : #%d / #%d : %d + %d (%v)\n", m.Msg.TGUserID64, tribute.ItemID64, tribute.Quantity, tribute.Exp, tribute.Date)
|
||||
}
|
||||
|
||||
cwm.Msg = m
|
||||
return &cwm, nil
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user