Hubot CronJobfunction

不能想出如何实现这一点。 我试图让Hubot定期在特定的时聊频道中调用一个函数。

目前,我可以通过让用户键入聊天“Hubot totalviewers”来完成此操作,而hubot将返回当前查看者的数量。 关键是让hubot自己做,而不必让用户键入命令(每分钟都会发生)。

任何文件,例子或帮助将不胜感激。

你可以使用node-cron

例如: https : //leanpub.com/automation-and-monitoring-with-hubot/read#leanpub-auto-periodic-task-execution

你可以使用setInterval ? 这与Hubot编写脚本时应该是可行的。

就像是…

setInterval -> do totalviewers , 60000 # 1 minute