test
This commit is contained in:
parent
273be366ca
commit
08e079da60
14
msg.go
14
msg.go
@ -278,14 +278,16 @@ func parseSubTypeMessageGStockAnyAck(m *ChatWarsMessage, r *regexp.Regexp) (*Cha
|
||||
func parseSubTypeMessageTributesStatsAck(m *ChatWarsMessage, r *regexp.Regexp) (*ChatWarsMessageTributesStatsAck, error) {
|
||||
cwm := ChatWarsMessageTributesStatsAck{}
|
||||
tribute := ChatWarsTribute{}
|
||||
log.Printf("parseSubTypeMessageTributesStatsAck : tributes :\n%s\n", r.ReplaceAllString(m.Text, "${Tributes}"))
|
||||
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}"))
|
||||
tribute.Date, err = fromChatWarsDate(re.ReplaceAllString(l[0], "${Date}"))
|
||||
/*
|
||||
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}"))
|
||||
*/
|
||||
d, err := fromChatWarsDate(re.ReplaceAllString(l[0], "${Date}"))
|
||||
tribute.Date = d
|
||||
logOnError(err, "parseSubTypeMessageTributesStatsAck : fromChatWarsDate")
|
||||
tribute.ItemID64 = getSilentObjItemID(``, re.ReplaceAllString(l[0], "${Item}"))
|
||||
tribute.Quantity, _ = strconv.ParseInt(r.ReplaceAllString(l[0], "${Quantity}"), 10, 64)
|
||||
|
2
sql.go
2
sql.go
@ -658,7 +658,7 @@ func insertMsgTributesStats(m *ChatWarsMessageTributesStatsAck) error {
|
||||
defer stmt.Close()
|
||||
|
||||
for _, t := range m.Tributes {
|
||||
_, err = stmt.Exec(m.Msg.TGUserID64, t.ItemID64, t.Quantity, t.Exp, t.Date)
|
||||
_, err := stmt.Exec(m.Msg.TGUserID64, t.ItemID64, t.Quantity, t.Exp, t.Date)
|
||||
logOnError(err, "insertMsgTributesStats Exec")
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user