This commit is contained in:
shoopea 2020-01-09 16:14:37 +08:00
parent e90f20fcb0
commit 7b674337c3

10
cron.go
View File

@ -14,7 +14,7 @@ func startCron() *cron.Cron {
c.AddFunc("58 6,14,22 * * *", cronSetDef) c.AddFunc("58 6,14,22 * * *", cronSetDef)
c.AddFunc("02 1,3,5,9,11,13,17,19,21 * * *", cronGetHammerTime) c.AddFunc("02 1,3,5,9,11,13,17,19,21 * * *", cronGetHammerTime)
c.AddFunc("10 7,15,23 * * *", cronGetHammerTime) c.AddFunc("10 7,15,23 * * *", cronGetHammerTime)
c.AddFunc("13 3, 7, 11, 15, 19, 23 * * *", cronTribute) c.AddFunc("13 3,7,11,15,19,23 * * *", cronTribute)
c.Start() c.Start()
return c return c
} }
@ -44,8 +44,12 @@ func cronSendWarReport() {
func cronTribute() { func cronTribute() {
muxClients.RLock() muxClients.RLock()
for _, c := range clients { for _, c := range clients {
if c.Active && c.CWClass == `Knight` { if c.Active {
clientSendCWMsgDelay(c.TGUserID64, `/tributes`, 0) log.Printf("cronTribute : class %s (%s)\n", c.CWClass, c.Login)
if c.CWClass == `Knight` {
log.Printf("cronTribute : sending tribute\n", c.CWClass, c.Login)
clientSendCWMsgDelay(c.TGUserID64, `/tributes`, 0)
}
} }
} }
muxClients.RUnlock() muxClients.RUnlock()