update items

This commit is contained in:
shoopea 2020-03-01 18:14:00 +08:00
parent ca5c2743e3
commit 62cd5b4501
3 changed files with 47 additions and 49 deletions

View File

@ -22,7 +22,6 @@ func startCron() *cron.Cron {
c.AddFunc("14 7,15,23 * * *", cronCheckVaultLimit)
c.AddFunc("15 7,15,23 * * *", cronSendWarReport)
c.AddFunc("@every 1m", cronSaveClients)
c.AddFunc("17 06 * * *", cronUpdateAngryBirbs)
c.Start()
return c
}

View File

@ -9810,7 +9810,7 @@
"quantity": 1
},
{
"code": "k98",
"code": "k94",
"quantity": 6
},
{

27
job.go
View File

@ -1693,9 +1693,6 @@ func jobGWithdraw(j Job) {
return
} else {
p.Validated = true
setJobCallback(j.ID64, j.UserID64, cacheObjSubType[`msg_withdraw_code`])
setJobCallback(j.ID64, j.UserID64, cacheObjSubType[`msg_withdraw_req`])
// TODO
}
} else {
err = rescheduleJob(j.ID64, 0, time.Unix(maxUnixTimestamp, 0).UTC())
@ -1703,8 +1700,6 @@ func jobGWithdraw(j Job) {
setJobCallback(j.ID64, int64(bot.Me.ID), cacheObjSubType[`msg_job_gwithdraw_ack`])
return
}
return
case cacheObjSubType[`msg_withdraw_code`]:
log.Printf("jobGWithdraw[%d] : Handling withdraw code.\n", j.ID64)
if false /* check if it's ours */ {
@ -1734,14 +1729,6 @@ func jobGWithdraw(j Job) {
}
}
/*
c, err := getLockedRoleClient(`commander`)
logOnError(err, "jobGWithdraw: getLockedRoleClient(commander)")
if err == nil {
c.Mux.Unlock()
}
*/
log.Printf("jobGWithdraw[%d] : Preparing withdrawal guild link.\n", j.ID64)
var stock string
for _, i := range p.Items {
@ -1753,6 +1740,17 @@ func jobGWithdraw(j Job) {
}
if len(stock) > 0 {
if p.Validated {
c, err := getLockedRoleClient(`commander`)
logOnError(err, "jobGWithdraw: getLockedRoleClient(commander)")
if err == nil {
c.Mux.Unlock()
}
setJobCallback(j.ID64, j.UserID64, cacheObjSubType[`msg_withdraw_code`])
setJobCallback(j.ID64, j.UserID64, cacheObjSubType[`msg_withdraw_req`])
return
} else {
err := setJobPayloadJSON(j.ID64, p)
logOnError(err, "jobGWithdraw : setJobPayloadJSON")
@ -1789,7 +1787,7 @@ func jobGWithdraw(j Job) {
u, err := bot.ChatByID(fmt.Sprintf("%d", p.UserID64))
logOnError(err, "jobGWithdraw : ChatByID")
msg := fmt.Sprintf("Click to validate @%s's withdrawal of<code>%s</code>\n/withdraw_%s", u.Username, stock, string(ref))
msg := fmt.Sprintf("Click to validate @%s's withdrawal of%s\n<code>/withdraw_%s</code>", u.Username, stock, string(ref))
cmd := TGCommand{
Type: commandSendMsg,
@ -1799,6 +1797,7 @@ func jobGWithdraw(j Job) {
}
TGCmdQueue <- cmd
return
}
} else {
cmd := TGCommand{
Type: commandReplyMsg,