test
This commit is contained in:
parent
0a9a2e9980
commit
959ffa7c17
1
bot.go
1
bot.go
@ -133,5 +133,4 @@ func botMsgRescanAll(m *tb.Message) (string, error) {
|
||||
} else {
|
||||
return "Rescaning all msg scheduled", nil
|
||||
}
|
||||
return "/msg_rescan msg_id or /msg_rescan all", nil
|
||||
}
|
||||
|
9
def.go
9
def.go
@ -34,10 +34,11 @@ type ChatWarsMessageMiniWar struct {
|
||||
}
|
||||
|
||||
type ChatWarsMessageMiniWarCastle struct {
|
||||
Result string `json:"result"`
|
||||
Gold int32 `json:"gold"`
|
||||
Stock int32 `json:"stock"`
|
||||
Points int32 `json:"points"`
|
||||
Gardian string `json:"gardian"`
|
||||
Result string `json:"result"`
|
||||
Gold int32 `json:"gold"`
|
||||
Stock int32 `json:"stock"`
|
||||
Points int32 `json:"points"`
|
||||
}
|
||||
|
||||
type MessageParsingRule struct {
|
||||
|
2
sql.go
2
sql.go
@ -1242,7 +1242,7 @@ func resetMsgParsingRules() {
|
||||
,(5000, ` + strconv.Itoa(objSubTypeMessageAuctionAnnounce) + `, "Auction annouce", "^Lot #(?P<Lot>[0-9]+) : (?P<Item>.*)\\n(Quality: (?P<Quality>.*)\\n){0,1}(Condition: (?P<Cond>.*)\\n){0,1}Seller: (?P<Seller>.*)\\nCurrent price: (?P<Price>[0-9]+) pouch\\(es\\)\\nBuyer: (?P<Buyer>.*)\\nEnd At: (?P<End>.*)\\nStatus: (?P<Status>.*)(\\n)*(?s:.*)")
|
||||
,(5000, ` + strconv.Itoa(objSubTypeMessageTimeAck) + `, "Time", "^In Chat Wars world now\\n(?P<Time>.*)\\n(?P<Hour>[0-9]{2}):(?P<Minute>[0-9]{2})\\n(?P<Day>[0-9]{2}) (?P<Month>.+) (?P<Year>[0-9]{4})\\n(?s:.*)$")
|
||||
,(5000, ` + strconv.Itoa(objSubTypeMessageMiniWar) + `, "Mini War", "^⛳️Battle results:\\n(?P<Gardian1>🔱){0,1}(?P<CastleLoot1>(🌑Moonlight|🐺Wolfpack|🦌Deerhorn|🐉Dragonscale|🦈Sharkteeth|🥔Potato|🦅Highnest)): (?P<CastleResult1>(🛡|🛡👌|⚔️|⚔️ ⚡️))( (?P<CastleGold1>(\\-|\\+)[0-9]+)💰){0,1}( (?P<CastleStock1>(\\-|\\+)[0-9]+)📦){0,1}\\n(?P<CastleLoot2>(🌑Moonlight|🐺Wolfpack|🦌Deerhorn|🐉Dragonscale|🦈Sharkteeth|🥔Potato|🦅Highnest)): (?P<CastleResult2>(🛡|🛡👌|⚔️|⚔️ ⚡️))( (?P<CastleGold2>(\\-|\\+)[0-9]+)💰){0,1}( (?P<CastleStock2>(\\-|\\+)[0-9]+)📦){0,1}\\n(?P<CastleLoot3>(🌑Moonlight|🐺Wolfpack|🦌Deerhorn|🐉Dragonscale|🦈Sharkteeth|🥔Potato|🦅Highnest)): (?P<CastleResult3>(🛡|🛡👌|⚔️|⚔️ ⚡️))( (?P<CastleGold3>(\\-|\\+)[0-9]+)💰){0,1}( (?P<CastleStock3>(\\-|\\+)[0-9]+)📦){0,1}\\n(?P<CastleLoot4>(🌑Moonlight|🐺Wolfpack|🦌Deerhorn|🐉Dragonscale|🦈Sharkteeth|🥔Potato|🦅Highnest)): (?P<CastleResult4>(🛡|🛡👌|⚔️|⚔️ ⚡️))( (?P<CastleGold4>(\\-|\\+)[0-9]+)💰){0,1}( (?P<CastleStock4>(\\-|\\+)[0-9]+)📦){0,1}\\n(?P<CastleLoot5>(🌑Moonlight|🐺Wolfpack|🦌Deerhorn|🐉Dragonscale|🦈Sharkteeth|🥔Potato|🦅Highnest)): (?P<CastleResult5>(🛡|🛡👌|⚔️|⚔️ ⚡️))( (?P<CastleGold5>(\\-|\\+)[0-9]+)💰){0,1}( (?P<CastleStock5>(\\-|\\+)[0-9]+)📦){0,1}\\n(?P<CastleLoot6>(🌑Moonlight|🐺Wolfpack|🦌Deerhorn|🐉Dragonscale|🦈Sharkteeth|🥔Potato|🦅Highnest)): (?P<CastleResult6>(🛡|🛡👌|⚔️|⚔️ ⚡️))( (?P<CastleGold6>(\\-|\\+)[0-9]+)💰){0,1}( (?P<CastleStock6>(\\-|\\+)[0-9]+)📦){0,1}\\n(?P<CastleLoot7>(🌑Moonlight|🐺Wolfpack|🦌Deerhorn|🐉Dragonscale|🦈Sharkteeth|🥔Potato|🦅Highnest)): (?P<CastleResult7>(🛡|🛡👌|⚔️|⚔️ ⚡️))( (?P<CastleGold7>(\\-|\\+)[0-9]+)💰){0,1}( (?P<CastleStock7>(\\-|\\+)[0-9]+)📦){0,1}\\n\\n🏆Scores:\\n(?P<CastleScore1>(🌑Moonlight|🐺Wolfpack|🦌Deerhorn|🐉Dragonscale|🦈Sharkteeth|🥔Potato|🦅Highnest)): (?P<Score1>\\+[0-9]+)\\n(?P<CastleScore2>(🌑Moonlight|🐺Wolfpack|🦌Deerhorn|🐉Dragonscale|🦈Sharkteeth|🥔Potato|🦅Highnest)): (?P<Score2>\\+[0-9]+)\\n(?P<CastleScore3>(🌑Moonlight|🐺Wolfpack|🦌Deerhorn|🐉Dragonscale|🦈Sharkteeth|🥔Potato|🦅Highnest)): (?P<Score3>\\+[0-9]+)\\n(?P<CastleScore4>(🌑Moonlight|🐺Wolfpack|🦌Deerhorn|🐉Dragonscale|🦈Sharkteeth|🥔Potato|🦅Highnest)): (?P<Score4>\\+[0-9]+)\\n(?P<CastleScore5>(🌑Moonlight|🐺Wolfpack|🦌Deerhorn|🐉Dragonscale|🦈Sharkteeth|🥔Potato|🦅Highnest)): (?P<Score5>\\+[0-9]+)\\n(?P<CastleScore6>(🌑Moonlight|🐺Wolfpack|🦌Deerhorn|🐉Dragonscale|🦈Sharkteeth|🥔Potato|🦅Highnest)): (?P<Score6>\\+[0-9]+)\\n(?P<CastleScore7>(🌑Moonlight|🐺Wolfpack|🦌Deerhorn|🐉Dragonscale|🦈Sharkteeth|🥔Potato|🦅Highnest)): (?P<Score7>\\+[0-9]+)\\n\\nBattle (?P<Time>[0-9]{2}/[0-9]{2}/[0-9]{2} [0-9]{2}:[0-9]{2})$")
|
||||
,(4000, ` + strconv.Itoa(objSubTypeMessageMiniWar) + `, "Mini War", "^⛳️Battle results:\\n(?P<Gardian1>🔱){0,1}(?P<CastleLoot1>(🌑Moonlight|🐺Wolfpack|🦌Deerhorn|🐉Dragonscale|🦈Sharkteeth|🥔Potato|🦅Highnest)): (?P<CastleResult1>.*)( (?P<CastleGold1>(\\-|\\+)[0-9]+)💰){0,1}( (?P<CastleStock1>(\\-|\\+)[0-9]+)📦){0,1}\\n(?P<Gardian1>🔱){0,1}(?P<CastleLoot1>(🌑Moonlight|🐺Wolfpack|🦌Deerhorn|🐉Dragonscale|🦈Sharkteeth|🥔Potato|🦅Highnest)): (?P<CastleResult2>.*)( (?P<CastleGold2>(\\-|\\+)[0-9]+)💰){0,1}( (?P<CastleStock2>(\\-|\\+)[0-9]+)📦){0,1}\\n(?s:.*)Battle (?P<Time>[0-9]{2}/[0-9]{2}/[0-9]{2} [0-9]{2}:[0-9]{2})$")
|
||||
,(4000, ` + strconv.Itoa(objSubTypeMessageMiniWar) + `, "Mini War", "^⛳️Battle results:\\n(?P<Gardian1>🔱){0,1}(?P<Loot1>(🌑Moonlight|🐺Wolfpack|🦌Deerhorn|🐉Dragonscale|🦈Sharkteeth|🥔Potato|🦅Highnest)): (?P<Result1>.*)( (?P<Gold1>(\\-|\\+)[0-9]+)💰){0,1}( (?P<Stock1>(\\-|\\+)[0-9]+)📦){0,1}\\n(?P<Gardian2>🔱){0,1}(?P<Loot2>(🌑Moonlight|🐺Wolfpack|🦌Deerhorn|🐉Dragonscale|🦈Sharkteeth|🥔Potato|🦅Highnest)): (?P<Result2>.*)( (?P<Gold2>(\\-|\\+)[0-9]+)💰){0,1}( (?P<Stock2>(\\-|\\+)[0-9]+)📦){0,1}\\n(?s:.*)Battle (?P<Time>[0-9]{2}/[0-9]{2}/[0-9]{2} [0-9]{2}:[0-9]{2})$")
|
||||
;`)
|
||||
failOnError(err, "resetMsgParsingRules : populate table msg_rules")
|
||||
}
|
||||
|
23
workers.go
23
workers.go
@ -99,8 +99,29 @@ func SQLIdentifyMsgWorker(id int, objIds <-chan int64) {
|
||||
log.Printf("SQLIdentifyMsgWorker["+strconv.Itoa(id)+"] : Stamina : %s (%d)\n", r.ReplaceAllString(m.Text, "${Stamina}"), objId)
|
||||
log.Printf("SQLIdentifyMsgWorker["+strconv.Itoa(id)+"] : Crit : %s (%d)\n", r.ReplaceAllString(m.Text, "${Crit}"), objId)
|
||||
case objSubTypeMessageMiniWar:
|
||||
_, err := time.Parse("02/01/06 15:04", r.ReplaceAllString(m.Text, "${Time}"))
|
||||
t, err := time.Parse("02/01/06 15:04", r.ReplaceAllString(m.Text, "${Time}"))
|
||||
logOnError(err, "SQLIdentifyMsgWorker["+strconv.Itoa(id)+"] : objSubTypeMessageMiniWar parsing time : "+r.ReplaceAllString(m.Text, "${Time}"))
|
||||
cwm := ChatWarsMessageMiniWar{
|
||||
Time: t,
|
||||
}
|
||||
g, err := strconv.Atoi(r.ReplaceAllString(m.Text, "${Gold1}"))
|
||||
s, err := strconv.Atoi(r.ReplaceAllString(m.Text, "${Stock1}"))
|
||||
rep := ChatWarsMessageMiniWarReport{
|
||||
Gardian: r.ReplaceAllString(m.Text, "${Gardian1}"),
|
||||
Result: r.ReplaceAllString(m.Text, "${Result1}"),
|
||||
Gold: g,
|
||||
Stock: s,
|
||||
}
|
||||
cwm.Report[r.ReplaceAllString(m.Text, "${Loot1}")] = rep
|
||||
g, err := strconv.Atoi(r.ReplaceAllString(m.Text, "${Gold2}"))
|
||||
s, err := strconv.Atoi(r.ReplaceAllString(m.Text, "${Stock2}"))
|
||||
rep = ChatWarsMessageMiniWarReport{
|
||||
Gardian: r.ReplaceAllString(m.Text, "${Gardian2}"),
|
||||
Result: r.ReplaceAllString(m.Text, "${Result2}"),
|
||||
Gold: g,
|
||||
Stock: s,
|
||||
}
|
||||
cwm.Report[r.ReplaceAllString(m.Text, "${Loot2}")] = rep
|
||||
/*
|
||||
if err == nil {
|
||||
log.Printf("SQLIdentifyMsgWorker["+strconv.Itoa(id)+"] : War time : %s (%d)\n", r.ReplaceAllString(m.Text, "${Time}"), objId)
|
||||
|
Loading…
Reference in New Issue
Block a user