This commit is contained in:
shoopea 2020-06-17 12:06:05 +02:00
parent 3d963439ae
commit 7f2fb9936e
2 changed files with 9 additions and 2 deletions

View File

@ -22,8 +22,7 @@ func startCron() *cron.Cron {
c.AddFunc("13 3,7,11,15,19,23 * * *", cronTribute) c.AddFunc("13 3,7,11,15,19,23 * * *", cronTribute)
c.AddFunc("59 6,14,22 * * *", cronCheckVaultLimit) c.AddFunc("59 6,14,22 * * *", cronCheckVaultLimit)
c.AddFunc("15 7,15,23 * * *", cronSendWarReport) c.AddFunc("15 7,15,23 * * *", cronSendWarReport)
c.AddFunc("55 6,14,22 * * *", cronAutoDeposit) c.AddFunc("53 6,14,22 * * *", cronAutoDeposit)
c.AddFunc("54 * * * *", cronAutoDeposit)
c.AddFunc("@every 1m", cronSaveClients) c.AddFunc("@every 1m", cronSaveClients)
c.Start() c.Start()
return c return c
@ -178,6 +177,7 @@ func cronAutoDeposit() {
} }
b, _ := json.Marshal(p) b, _ := json.Marshal(p)
t := time.Now().UTC() t := time.Now().UTC()
t.Add(time.Duration(RndIntn(300)))
_, err := createJob(cacheObjSubType[`job_gdeposit`], objJobPriority, c.TGUserID64, 0, t, b) _, err := createJob(cacheObjSubType[`job_gdeposit`], objJobPriority, c.TGUserID64, 0, t, b)
logOnError(err, "cronAutoDeposit : createJob") logOnError(err, "cronAutoDeposit : createJob")
} }

View File

@ -109,6 +109,13 @@ func RndInt64() int64 {
return i return i
} }
func RndIntn(n int) int {
RndMux.Lock()
i := RndSrc.Intn(n)
RndMux.Unlock()
return i
}
func hammerTimeNow(time string, weather string) bool { func hammerTimeNow(time string, weather string) bool {
if time == `🌞Morning` && weather == `🌧` || if time == `🌞Morning` && weather == `🌧` ||
time == `🌙Evening` && weather == `🌤` || time == `🌙Evening` && weather == `🌤` ||