update withdraw rcv
This commit is contained in:
parent
d947c3b2e4
commit
df64c9da54
22
msg.go
22
msg.go
@ -222,20 +222,18 @@ 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])
|
||||
q, _ := strconv.ParseInt(l[2], 10, 64)
|
||||
if i != 0 {
|
||||
item := ChatWarsItems{
|
||||
ItemID64: i,
|
||||
Quantity: q,
|
||||
}
|
||||
items = append(items, item)
|
||||
re := regexp.MustCompile(`(.*) x (.*)`)
|
||||
for _, l := range re.FindAllStringSubmatch(m.Text, -1) {
|
||||
i := getObjItemID(``, l[1])
|
||||
q, _ := strconv.ParseInt(l[2], 10, 64)
|
||||
if i != 0 {
|
||||
item := ChatWarsItems{
|
||||
ItemID64: i,
|
||||
Quantity: q,
|
||||
}
|
||||
items = append(items, item)
|
||||
}
|
||||
*/
|
||||
}
|
||||
cwm.ItemList = items
|
||||
return &cwm, nil
|
||||
}
|
||||
|
12
rules.go
12
rules.go
@ -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]+\\))*)$")
|
||||
|
@ -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:
|
||||
|
Loading…
Reference in New Issue
Block a user