This commit is contained in:
shoopea 2019-05-08 18:33:52 +08:00
parent afdf512fc6
commit d0a5fc5129
2 changed files with 5 additions and 3 deletions

5
def.go
View File

@ -1,5 +1,9 @@
package main
import (
"regexp"
)
type ChatWarsMessage struct {
UserID64 int64 `json:"user_id"`
SenderUserID64 int64 `json:"sender_user_id"`
@ -15,6 +19,7 @@ type MessageParsingRule struct {
Description string
Rule string
MsgTypeID int32
re *regexp.Regexp
}
const (

View File

@ -3,7 +3,6 @@ package main
import (
"encoding/json"
"log"
"regexp"
"strconv"
"time"
@ -78,8 +77,6 @@ func SQLIdentifyMsgWorker(id int, objIds <-chan int64) {
logOnError(err, "SQLIdentifyMsgWorker["+strconv.Itoa(id)+"] : Retrieving message.")
if err == nil {
log.Printf("SQLIdentifyMsgWorker["+strconv.Itoa(id)+"] : Message retrieved (%d)\n%s\n", objId, m.Text)
// War reports
// r := regexp.MustCompile(`^(?P<Castle>.)(?P<Guild>(\[[A-Z]{3}\]){0,1})(?P<User>([A-Za-z0-9 ]*)) ⚔:(?P<Attack>[0-9]+) .:(?P<Defense>[0-9]+) Lvl: (?P<Level>[0-9]+)\nYour result on the battlefield:\n.Exp: (?P<Exp>[0-9]+)\n.Gold: (?P<Gold>[0-9]+)\n.Stock: (?P<Stock>[0-9]+)\n(?s:.*)$`) // FIXME defense/exp/gold/stock characters !
for i = 0; i < len(msgParsingRules) && msgParsingRules[i].re.FindStringSubmatch(m.Text) != nil; i++ {
}