This commit is contained in:
shoopea 2020-01-17 12:27:01 +08:00
parent 95370ec747
commit 4170f0ff95

12
job.go
View File

@ -160,7 +160,7 @@ func setJobPayload(jobID64 int64, payload []byte) error {
muxObjJob.Lock() muxObjJob.Lock()
j := cacheObjJob[jobID64] j := cacheObjJob[jobID64]
j.Payload = b j.Payload = payload
cacheObjJob[jobID64] = j cacheObjJob[jobID64] = j
muxObjJob.Unlock() muxObjJob.Unlock()
@ -1506,6 +1506,10 @@ func jobGWithdraw(j Job) {
} }
if id == cacheObjSubType[`msg_msg_job_gwithdraw_ack`] { if id == cacheObjSubType[`msg_msg_job_gwithdraw_ack`] {
m, err := getObjMsg(j.Trigger)
logOnError(err, "jobGWithdraw : getObjMsg")
rule, err := getMsgParsingRule(m)
logOnError(err, "jobGWithdraw : getMsgParsingRule")
cwm, err := parseSubTypeMessageJobGWithdrawAck(m, rule.re) cwm, err := parseSubTypeMessageJobGWithdrawAck(m, rule.re)
logOnError(err, "jobGWithdraw : parseSubTypeMessageJobGWithdrawAck") logOnError(err, "jobGWithdraw : parseSubTypeMessageJobGWithdrawAck")
in, err := hex.DecodeString(cwm.Ref) in, err := hex.DecodeString(cwm.Ref)
@ -1544,7 +1548,7 @@ func jobGWithdraw(j Job) {
p.Validated = true p.Validated = true
for _, d := range p.CleanupMsg { for _, d := range p.CleanupMsg {
delmsg := tb.StoredMessage{ delmsg := tb.StoredMessage{
MessageID: fmt.Sprintf("%d", d.MsgID64), MessageID: fmt.Sprintf("%d", d.ID64),
ChatID: d.ChatID64, ChatID: d.ChatID64,
} }
err = bot.Delete(delmsg) err = bot.Delete(delmsg)
@ -1561,7 +1565,7 @@ func jobGWithdraw(j Job) {
} else { } else {
err = rescheduleJob(j.ID64, 0, time.Unix(maxUnixTimestamp, 0).UTC()) err = rescheduleJob(j.ID64, 0, time.Unix(maxUnixTimestamp, 0).UTC())
logOnError(err, "jobGWithdraw : rescheduleJob") logOnError(err, "jobGWithdraw : rescheduleJob")
setJobCallback(j.ID64, int64(bot.Me.ID), cacheObjTypeId[`msg_job_gwithdraw_ack`]) setJobCallback(j.ID64, int64(bot.Me.ID), cacheObjSubType[`msg_job_gwithdraw_ack`])
return return
} }
@ -1682,7 +1686,7 @@ func jobGWithdraw(j Job) {
b, _ := json.Marshal(p) b, _ := json.Marshal(p)
id, err := createJob(cacheObjSubType[`job_gwithdraw`], objJobPriority, j.UserID64, 0, time.Unix(maxUnixTimestamp, 0).UTC(), b) id, err := createJob(cacheObjSubType[`job_gwithdraw`], objJobPriority, j.UserID64, 0, time.Unix(maxUnixTimestamp, 0).UTC(), b)
logOnError(err, "jobGWithdraw : createJob") logOnError(err, "jobGWithdraw : createJob")
setJobCallback(id, int64(bot.Me.ID), cacheObjTypeId[`msg_job_gwithdraw_ack`]) setJobCallback(id, int64(bot.Me.ID), cacheObjSubType[`msg_job_gwithdraw_ack`])
sha256 := sha256.Sum256([]byte(cfg.Telegram.Token)) sha256 := sha256.Sum256([]byte(cfg.Telegram.Token))
sha128 := sha256[:aes.BlockSize] sha128 := sha256[:aes.BlockSize]