30 lines
434 B
Go
30 lines
434 B
Go
package main
|
|
|
|
import (
|
|
//"github.com/robfig/cron/v3"
|
|
"gopkg.in/robfig/cron.v3"
|
|
)
|
|
|
|
func startCron() *Cron {
|
|
c := cron.New(cron.WithLocation(time.UTC))
|
|
c.AddFunc("@every 1m", cronSendReport)
|
|
c.Start()
|
|
return
|
|
}
|
|
|
|
func stopCron(c *Cron) {
|
|
c.Stop()
|
|
return
|
|
}
|
|
|
|
func cronSendReport() {
|
|
muxClients.RLock()
|
|
for id, c := range clients {
|
|
if c.Active {
|
|
clientSendCWMsg(c.TGUserID64, `/report`)
|
|
}
|
|
}
|
|
muxClients.RUnlock()
|
|
return
|
|
}
|