Skip to content

Commit

Permalink
增加/task命令 cron时间自定义
Browse files Browse the repository at this point in the history
  • Loading branch information
iyear committed Apr 2, 2020
1 parent eab92df commit 15b93d4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ func MakeHandle() {
fmt.Println("Make Handle……")
bot.Handle("/start", bStart)
bot.Handle("/my", bMy)
bot.Handle("/task", bTask)
bot.Handle("/bind", bBind1)
bot.Handle("/unbind", bUnBind)
bot.Handle("/help", bHelp)
Expand All @@ -97,9 +98,8 @@ func MakeHandle() {
func TaskLaunch() {
task := cron.New()
//每三小时执行一次
task.AddFunc("1 */3 * * *", SignTask)
task.AddFunc(viper.GetString("cron"), SignTask)
// */1 * * * * 1 */3 * * *
fmt.Println("Cron Task Start……")
task.Start()
defer task.Stop()
}

0 comments on commit 15b93d4

Please sign in to comment.