我无法正确设置 Hubot 和 node-cron 以在我的 IRC 频道中执行任务。
此页面显示了我最初如何设置我的代码: https ://leanpub.com/automation-and-monitoring-with-hubot/read#leanpub-auto-periodic-task-execution
这是 node-cron 的链接: https ://github.com/ncb000gt/node-cron
我在想我遇到了 Hubot 的 IRC 适配器的问题,但我不确定。欢迎任何建议和代码示例。
这是我最终进行测试的地方:
module.exports = (robot) ->
cronJob = require('cron').CronJob
tz = 'America/Minneapolis'
new cronJob('30 * * * * *', testFunction, true, tz)
room = '#support' #not used in this case
testFunction = ->
robot.send "I work!"
或来自 Leanpub 的示例
testFunction = ->
robot.messageRoom room "I work!"
Hubot 运行正常后的 cron 作业设置:
Hubot new job "<crontab format>" <message> - Schedule a cron job to say something
再次感谢大家!