update withdraw rcv

This commit is contained in:
shoopea 2019-10-11 09:21:09 +08:00
parent d947c3b2e4
commit df64c9da54
3 changed files with 17 additions and 23 deletions

2
msg.go
View File

@ -222,7 +222,6 @@ func parseSubTypeMessageAuctionAnnounce(m *ChatWarsMessage, r *regexp.Regexp) (*
func parseSubTypeMessageWithdrawRcv(m *ChatWarsMessage, r *regexp.Regexp) (*ChatWarsMessageWithdrawRcv, error) {
cwm := ChatWarsMessageWithdrawRcv{}
items := []ChatWarsItems{}
/*
re := regexp.MustCompile(`(.*) x (.*)`)
for _, l := range re.FindAllStringSubmatch(m.Text, -1) {
i := getObjItemID(``, l[1])
@ -235,7 +234,6 @@ func parseSubTypeMessageWithdrawRcv(m *ChatWarsMessage, r *regexp.Regexp) (*Chat
items = append(items, item)
}
}
*/
cwm.ItemList = items
return &cwm, nil
}

View File

@ -90,16 +90,8 @@ func resetMsgParsingRules() {
`((?P<Item8>.*) x (?P<Quantity8>.*)\\n){0,1}` +
`Recipient shall send to bot:\\n` +
`/g_receive [a-z0-9]+$")
,(5000, ` + strconv.Itoa(objSubTypeMessageWithdrawRcv) + `, "Withdraw Received #1", "^Received (?P<Item1>.*) x (?P<Quantity1>.*)$")
,(5000, ` + strconv.Itoa(objSubTypeMessageWithdrawRcv) + `, "Withdraw Received #2", "^Received:` +
`(\\n(?P<Item1>.*) x (?P<Quantity1>.*))` +
`(\\n(?P<Item2>.*) x (?P<Quantity2>.*)){0,1}` +
`(\\n(?P<Item3>.*) x (?P<Quantity3>.*)){0,1}` +
`(\\n(?P<Item4>.*) x (?P<Quantity4>.*)){0,1}` +
`(\\n(?P<Item5>.*) x (?P<Quantity5>.*)){0,1}` +
`(\\n(?P<Item6>.*) x (?P<Quantity6>.*)){0,1}` +
`(\\n(?P<Item7>.*) x (?P<Quantity7>.*)){0,1}` +
`(\\n(?P<Item8>.*) x (?P<Quantity8>.*)){0,1}$")
,(5000, ` + strconv.Itoa(objSubTypeMessageWithdrawRcv) + `, "Withdraw Received #1", "^Received (?P<Items>(.*) x (.*))$")
,(5000, ` + strconv.Itoa(objSubTypeMessageWithdrawRcv) + `, "Withdraw Received #2", "^Received:(?P<Items>(\\n(.*) x (.*))*)$")
,(5000, ` + strconv.Itoa(objSubTypeMessageStockReq) + `, "Stock Req", "^/stock$")
,(5000, ` + strconv.Itoa(objSubTypeMessageStockAck) + `, "Stock Ack", "^📦Storage \\((?P<Used>[0-9]+)\\/(?P<Available>[0-9]+)\\):` +
`(?P<Items>(\\n[a-zA-Z ]+ \\([0-9]+\\))*)$")

View File

@ -362,8 +362,12 @@ func SQLIdentifyMsgWorker(id int, objIds <-chan int64) {
case objSubTypeMessageWithdrawReq:
case objSubTypeMessageWithdrawCode:
case objSubTypeMessageWithdrawRcv:
_, err := parseSubTypeMessageWithdrawRcv(m, rule.re)
cwm, err := parseSubTypeMessageWithdrawRcv(m, rule.re)
logOnError(err, "SQLIdentifyMsgWorker["+strconv.Itoa(id)+"] : Parsing objSubTypeMessageWithdrawRcv.")
for _, i := range cwm.ItemList {
err = insertMsgItem(cwm.Msg.ObjID64, i.ItemID64, i.Quantity)
logOnError(err, "SQLIdentifyMsgWorker["+strconv.Itoa(id)+"] : Inserting objSubTypeMessageWithdrawRcv.")
}
case objSubTypeMessageStockReq:
case objSubTypeMessageMiscReq:
case objSubTypeMessageGStockResReq: