test
This commit is contained in:
parent
afdf512fc6
commit
d0a5fc5129
5
def.go
5
def.go
@ -1,5 +1,9 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"regexp"
|
||||||
|
)
|
||||||
|
|
||||||
type ChatWarsMessage struct {
|
type ChatWarsMessage struct {
|
||||||
UserID64 int64 `json:"user_id"`
|
UserID64 int64 `json:"user_id"`
|
||||||
SenderUserID64 int64 `json:"sender_user_id"`
|
SenderUserID64 int64 `json:"sender_user_id"`
|
||||||
@ -15,6 +19,7 @@ type MessageParsingRule struct {
|
|||||||
Description string
|
Description string
|
||||||
Rule string
|
Rule string
|
||||||
MsgTypeID int32
|
MsgTypeID int32
|
||||||
|
re *regexp.Regexp
|
||||||
}
|
}
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
@ -3,7 +3,6 @@ package main
|
|||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"log"
|
"log"
|
||||||
"regexp"
|
|
||||||
"strconv"
|
"strconv"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
@ -78,8 +77,6 @@ func SQLIdentifyMsgWorker(id int, objIds <-chan int64) {
|
|||||||
logOnError(err, "SQLIdentifyMsgWorker["+strconv.Itoa(id)+"] : Retrieving message.")
|
logOnError(err, "SQLIdentifyMsgWorker["+strconv.Itoa(id)+"] : Retrieving message.")
|
||||||
if err == nil {
|
if err == nil {
|
||||||
log.Printf("SQLIdentifyMsgWorker["+strconv.Itoa(id)+"] : Message retrieved (%d)\n%s\n", objId, m.Text)
|
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++ {
|
for i = 0; i < len(msgParsingRules) && msgParsingRules[i].re.FindStringSubmatch(m.Text) != nil; i++ {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user