友添加了一个任务

This commit is contained in:
2022-09-27 22:17:33 +08:00
parent 407a35e629
commit 3afa9120d0

View File

@@ -28,12 +28,19 @@ func SignInBegin(msg *openwechat.Message, self *openwechat.Self) {
self.SendTextToGroup(name, "成天就知道玩,你可张点心吧!")
}
//定义定时器调用的任务函数
task2 := func() {
self.SendTextToGroup(name, "同志们学习了!")
}
//定时任务
spec := "0 0 9 * * ?" //cron表达式每天9点
spec1 := "0 10 9 * * ?" //cron表达式每天9点
spec := "0 0 9 * * ?" //cron表达式每天9点
spec1 := "0 10 9 * * ?" //cron表达式每天9点
spec2 := "0 11 22 * * ?" //cron表达式每天9点
// 添加定时任务,
crontab.AddFunc(spec, task)
crontab.AddFunc(spec1, task1)
crontab.AddFunc(spec2, task2)
// 启动定时器
crontab.Start()