This commit is contained in:
shoopea 2019-05-26 21:06:12 +08:00
parent de41d0196b
commit 06b697067c
4 changed files with 28 additions and 10 deletions

20
bot.go
View File

@ -284,18 +284,18 @@ func botTimer(m *tb.Message) {
}
TGCmdQueue <- c
} else {
log.Printf("Timer : Event : %s\n", time.Now().Add(d).Format(time.RFC822))
log.Printf("Timer : Event : %s\n", time.Now().Add(d).Format(time.RFC850))
c := TGCommand{
Type: commandSendMsg,
Text: "", r.ReplaceAllString(m.Payload, "${Msg}"),
FromUserID64: m.Chat.ID,
ToChatID64: userID64ChtWrsBot,
}
b, _ := json.Marshal(c)
err := createJob(objSubTypeJobMsgClient, objJobPriority, int64(m.Sender.ID), time.Now(), b)
}
}
/*
c := TGCommand{
Type: commandReplyMsg,
Text: res,
FromMsgID64: int64(m.ID),
FromChatID64: m.Chat.ID,
}
TGCmdQueue <- c
*/
return
}

1
def.go
View File

@ -252,6 +252,7 @@ const (
objSubTypeJobGStock = 605
objSubTypeJobRescanMsg = 606
objSubTypeJobSetJobDone = 607
objSubTypeJobMsgClient = 608
objSubTypeItemResource = 701
objSubTypeItemAlch = 702
objSubTypeItemMisc = 703

15
job.go
View File

@ -120,3 +120,18 @@ func jobPillage(j Job) {
logOnError(err, "jobSetDone : setJobDone")
return
}
func jobMsgClient(j Job) {
var c TGCommand
err := setJobStart(j.ID64)
logOnError(err, "jobMsgClient : setJobStart")
err = json.Unmarshal(j.Payload, &c)
logOnError(err, "jobMsgClient : Unmarshal payload")
MQTGCmdQueue <- c
err := setJobDone(j.ID64)
logOnError(err, "joMsgClient : setJobDone")
return
}

View File

@ -271,6 +271,8 @@ func SQLJobWorker(id int) {
jobSetDone(j)
case objSubTypeJobPillage:
jobPillage(j)
case objSubTypeJobMsgClient:
jobMsgClient(j)
default:
log.Printf("SQLJobWorker["+strconv.Itoa(id)+"] : No handler for job type #%d.\n", j.JobTypeID)
}