From f79e9d5f663427ae7d3c1f41d9ec85e344437080 Mon Sep 17 00:00:00 2001 From: shoopea Date: Sun, 5 Jan 2020 17:42:29 +0800 Subject: [PATCH] test --- bot.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/bot.go b/bot.go index e8967b9..b9cd9b7 100644 --- a/bot.go +++ b/bot.go @@ -931,7 +931,7 @@ func botGWithdraw(m *tb.Message) { r := regexp.MustCompile("^(( )*[a-z0-9]+ [0-9]+( )*)+$") if r.MatchString(m.Payload) { - rx := regexp.MustCompile("[a-z0-9]+ [0-9]+") + rx := regexp.MustCompile("(?P[a-z0-9]+) (?P[0-9]+)") p := JobPayloadGWithdraw{ MsgID64: int64(m.ID), ChatID64: m.Chat.ID, @@ -939,8 +939,9 @@ func botGWithdraw(m *tb.Message) { } items := []ChatWarsItems{} for _, l := range rx.FindAllStringSubmatch(m.Payload, -1) { - i := l[0] - q, _ := strconv.ParseInt(l[1], 10, 64) + log.Printf("botGWithdraw : %s\n", l) + i := r.ReplaceAllString(l, "${Item}") + q, _ := strconv.ParseInt(r.ReplaceAllString(l, "${Quantity}"), 10, 64) item := ChatWarsItems{ Item: i, Quantity: q,