test
This commit is contained in:
parent
0b14e0d5ce
commit
33aa4ea6dc
16
def.go
16
def.go
@ -6,6 +6,16 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
type ChatWarsCommand struct {
|
||||||
|
Type int64 `json:"type"`
|
||||||
|
FromChatID64 int64 `json:"from_chat_id"`
|
||||||
|
FromUserID64 int64 `json:"from_user_id"`
|
||||||
|
FromMsgID64 int64 `json:"from_msg_id"`
|
||||||
|
ToChatID64 int64 `json:"to_chat_id"`
|
||||||
|
ToUserID64 int64 `json:"to_user_id"`
|
||||||
|
Text string `json:"text"`
|
||||||
|
}
|
||||||
|
|
||||||
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"`
|
||||||
@ -92,6 +102,12 @@ type JobPayloadSetDone struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
commandForwardMsg = 1
|
||||||
|
commandReplyMsg = 2
|
||||||
|
commandSendMsg = 3
|
||||||
|
commandDeleteMsg = 4
|
||||||
|
commandRefreshMsg = 5
|
||||||
|
|
||||||
objTypeUser = 1
|
objTypeUser = 1
|
||||||
objTypeGuild = 2
|
objTypeGuild = 2
|
||||||
objTypeMessage = 3
|
objTypeMessage = 3
|
||||||
|
4
sql.go
4
sql.go
@ -1305,7 +1305,8 @@ func resetMsgParsingRules() {
|
|||||||
`.*(?P<Score7>(Moonlight|Wolfpack|Deerhorn|Dragonscale|Sharkteeth|Potato|Highnest)): (?P<Points7>\\+([0-9]+|NaN))\\n` +
|
`.*(?P<Score7>(Moonlight|Wolfpack|Deerhorn|Dragonscale|Sharkteeth|Potato|Highnest)): (?P<Points7>\\+([0-9]+|NaN))\\n` +
|
||||||
`(?s:.*)` +
|
`(?s:.*)` +
|
||||||
`Battle (?P<Time>[0-9]{2}/[0-9]{2}/[0-9]{2} [0-9]{2}:[0-9]{2})$")
|
`Battle (?P<Time>[0-9]{2}/[0-9]{2}/[0-9]{2} [0-9]{2}:[0-9]{2})$")
|
||||||
;`)
|
,(5000, ` + strconv.Itoa(objSubTypeMessagePillageInc) + `, "Pillage Inc", "^You were strolling around on your horse when you noticed (?P<Attacker>.*) of .{1}(?P<Castle>(Moonlight|Wolfpack|Deerhorn|Dragonscale|Sharkteeth|Potato|Highnest)) Castle trying to pillage a local village. To stop him click /go$")` +
|
||||||
|
`;`)
|
||||||
failOnError(err, "resetMsgParsingRules : populate table msg_rules")
|
failOnError(err, "resetMsgParsingRules : populate table msg_rules")
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1461,6 +1462,7 @@ func insertMsgAuctionAnnounce(m *ChatWarsMessageAuctionAnnounce) error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
13
workers.go
13
workers.go
@ -106,7 +106,9 @@ func SQLIdentifyMsgWorker(id int, objIds <-chan int64) {
|
|||||||
logOnError(err, "SQLIdentifyMsgWorker["+strconv.Itoa(id)+"] : insertMsgMiniWar")
|
logOnError(err, "SQLIdentifyMsgWorker["+strconv.Itoa(id)+"] : insertMsgMiniWar")
|
||||||
err = setObjSubTypeId(objId, objSubTypeMessageMiniWar)
|
err = setObjSubTypeId(objId, objSubTypeMessageMiniWar)
|
||||||
logOnError(err, "SQLIdentifyMsgWorker["+strconv.Itoa(id)+"] : setObjSubTypeId(MiniWar)")
|
logOnError(err, "SQLIdentifyMsgWorker["+strconv.Itoa(id)+"] : setObjSubTypeId(MiniWar)")
|
||||||
|
case objSubTypeMessagePillageInc:
|
||||||
|
err = setObjSubTypeId(objId, objSubTypeMessagePillageInc)
|
||||||
|
logOnError(err, "SQLIdentifyMsgWorker["+strconv.Itoa(id)+"] : setObjSubTypeId(PillageInc)")
|
||||||
case objSubTypeMessageAuctionAnnounce:
|
case objSubTypeMessageAuctionAnnounce:
|
||||||
cwm := ChatWarsMessageAuctionAnnounce{
|
cwm := ChatWarsMessageAuctionAnnounce{
|
||||||
ObjID64: objId,
|
ObjID64: objId,
|
||||||
@ -127,15 +129,6 @@ func SQLIdentifyMsgWorker(id int, objIds <-chan int64) {
|
|||||||
err = setObjSubTypeId(objId, objSubTypeMessageAuctionAnnounce)
|
err = setObjSubTypeId(objId, objSubTypeMessageAuctionAnnounce)
|
||||||
logOnError(err, "SQLIdentifyMsgWorker["+strconv.Itoa(id)+"] : setObjSubTypeId(AuctionAnnounce)")
|
logOnError(err, "SQLIdentifyMsgWorker["+strconv.Itoa(id)+"] : setObjSubTypeId(AuctionAnnounce)")
|
||||||
case objSubTypeMessageTimeAck:
|
case objSubTypeMessageTimeAck:
|
||||||
/*
|
|
||||||
log.Printf("SQLIdentifyMsgWorker["+strconv.Itoa(id)+"] : Time (%d)\n", objId)
|
|
||||||
log.Printf("SQLIdentifyMsgWorker["+strconv.Itoa(id)+"] : Time : %s (%d)\n", r.ReplaceAllString(m.Text, "${Time}"), objId)
|
|
||||||
log.Printf("SQLIdentifyMsgWorker["+strconv.Itoa(id)+"] : Hour : %s (%d)\n", r.ReplaceAllString(m.Text, "${Hour}"), objId)
|
|
||||||
log.Printf("SQLIdentifyMsgWorker["+strconv.Itoa(id)+"] : Minute : %s (%d)\n", r.ReplaceAllString(m.Text, "${Minute}"), objId)
|
|
||||||
log.Printf("SQLIdentifyMsgWorker["+strconv.Itoa(id)+"] : Day : %s (%d)\n", r.ReplaceAllString(m.Text, "${Day}"), objId)
|
|
||||||
log.Printf("SQLIdentifyMsgWorker["+strconv.Itoa(id)+"] : Month : %s (%d)\n", r.ReplaceAllString(m.Text, "${Month}"), objId)
|
|
||||||
log.Printf("SQLIdentifyMsgWorker["+strconv.Itoa(id)+"] : Year : %s (%d)\n", r.ReplaceAllString(m.Text, "${Year}"), objId)
|
|
||||||
*/
|
|
||||||
_, err := fromChatWarsDate(r.ReplaceAllString(m.Text, "${Day}") + " " + r.ReplaceAllString(m.Text, "${Month}") + " " + r.ReplaceAllString(m.Text, "${Year}") + " " + r.ReplaceAllString(m.Text, "${Hour}") + ":" + r.ReplaceAllString(m.Text, "${Minute}"))
|
_, err := fromChatWarsDate(r.ReplaceAllString(m.Text, "${Day}") + " " + r.ReplaceAllString(m.Text, "${Month}") + " " + r.ReplaceAllString(m.Text, "${Year}") + " " + r.ReplaceAllString(m.Text, "${Hour}") + ":" + r.ReplaceAllString(m.Text, "${Minute}"))
|
||||||
logOnError(err, "SQLIdentifyMsgWorker["+strconv.Itoa(id)+"] : fromChatWarsDate")
|
logOnError(err, "SQLIdentifyMsgWorker["+strconv.Itoa(id)+"] : fromChatWarsDate")
|
||||||
err = setObjSubTypeId(objId, objSubTypeMessageTimeAck)
|
err = setObjSubTypeId(objId, objSubTypeMessageTimeAck)
|
||||||
|
Loading…
Reference in New Issue
Block a user