update angrybirbs
This commit is contained in:
parent
50794c8b1e
commit
7088bfa291
19
cron.go
19
cron.go
@ -15,12 +15,14 @@ import (
|
||||
func startCron() *cron.Cron {
|
||||
c := cron.New(cron.WithLocation(time.UTC))
|
||||
c.AddFunc("58 6,14,22 * * *", cronSetDef)
|
||||
c.AddFunc("00 0 * * *", cronUpdateAngryBirbs)
|
||||
c.AddFunc("02 1,3,5,9,11,13,17,19,21 * * *", cronGetHammerTime)
|
||||
c.AddFunc("12 7,15,23 * * *", cronGetHammerTime)
|
||||
c.AddFunc("13 3,7,11,15,19,23 * * *", cronTribute)
|
||||
c.AddFunc("14 7,15,23 * * *", cronCheckVaultLimit)
|
||||
c.AddFunc("15 7,15,23 * * *", cronSendWarReport)
|
||||
c.AddFunc("@every 1m", cronSaveClients)
|
||||
c.AddFunc("06 15 * * *", cronUpdateAngryBirbs)
|
||||
c.Start()
|
||||
return c
|
||||
}
|
||||
@ -30,6 +32,23 @@ func stopCron(c *cron.Cron) {
|
||||
return
|
||||
}
|
||||
|
||||
func cronUpdateAngryBirbs() {
|
||||
muxClients.RLock()
|
||||
for _, c := range clients {
|
||||
if c.Active {
|
||||
p := JobPayloadMsgFwd{
|
||||
ChatID64: cfg.Bot.AngryBirbs,
|
||||
}
|
||||
b, _ := json.Marshal(&p)
|
||||
err := createJobCallback(cacheObjSubType[`job_msg_fwd`], c.TGUserID64, cacheObjSubType[`msg_me_ack`], b, 1*time.Minute)
|
||||
logOnError(err, "cronUpdateAngryBirbs : createJobCallback")
|
||||
clientSendCWMsgDelay(c.TGUserID64, `/me`, 0)
|
||||
}
|
||||
}
|
||||
muxClients.RUnlock()
|
||||
return
|
||||
}
|
||||
|
||||
func cronSendWarReport() {
|
||||
muxClients.RLock()
|
||||
for _, c := range clients {
|
||||
|
@ -24,6 +24,7 @@
|
||||
"main_chat_id": 0,
|
||||
"deposit_chat_id": 0,
|
||||
"report_chat_id": 0,
|
||||
"angrybirbs_id": 833409972,
|
||||
"vault_limit": [
|
||||
{
|
||||
"item" : "01",
|
||||
|
1
def.go
1
def.go
@ -40,6 +40,7 @@ type Config struct {
|
||||
Mainchat int64 `json:"main_chat_id"`
|
||||
Depositchat int64 `json:"deposit_chat_id"`
|
||||
Reportchat int64 `json:"report_chat_id"`
|
||||
AngryBirbs int64 `json:"angrybirbs_id"`
|
||||
VaultLimit []struct {
|
||||
Item string `json:"item"`
|
||||
Min int64 `json:"min_qty"`
|
||||
|
1
job.go
1
job.go
@ -2075,6 +2075,7 @@ func jobAlchAll(j Job) {
|
||||
|
||||
setJobCallback(j.ID64, j.UserID64, cacheObjSubType[`msg_skill_too_low`])
|
||||
setJobCallback(j.ID64, j.UserID64, cacheObjSubType[`msg_alch_stock_ack`])
|
||||
setJobCallback(j.ID64, j.UserID64, cacheObjSubType[`msg_busy`])
|
||||
rescheduleJob(j.ID64, 0, time.Unix(maxUnixTimestamp, 0).UTC())
|
||||
clientSendCWMsgDelay(j.UserID64, "/alch", 2*time.Second)
|
||||
return
|
||||
|
Loading…
Reference in New Issue
Block a user