让Hubot在某个时间说话? [英] Get Hubot to talk at a certain time?
本文介绍了让Hubot在某个时间说话?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
[编辑]下面是一个使用node-cron的例子:/ p>
TIMEZONE =America / New_York
QUITTING_TIME ='0 0 17 * * 2-6'#MF 5pm
ROOM =Dev
cronJob = require('cron')CronJob
module.exports =(robot) - >
gohome = new cronJob QUITTING_TIME,
- >
robot.messageRoom ROOM,这是5!回家!
null
true
TIMEZONE
dependencies:
cron:0.3.3,
time:0.8.2
解决方案我会使用node-cron。它非常灵活,适合您的用例。
https://github.com/ncb000gt/node-cron
I'm thinking about making a Hubot clock-based notifier (think "It's 5, time to go home!" but less annoying and for a different reason). What's the best way to go about doing something like this in a Hubot script?
[edit] Here's an example using node-cron:
TIMEZONE = "America/New_York" QUITTING_TIME = '0 0 17 * * 2-6' # M-F 5pm ROOM = "Dev" cronJob = require('cron').CronJob module.exports = (robot) -> gohome = new cronJob QUITTING_TIME, -> robot.messageRoom ROOM, "It's 5! Go home!" null true TIMEZONE
dependencies:
"cron": "0.3.3", "time": "0.8.2"
解决方案I would use node-cron. It's pretty flexible and fits your use case well.
这篇关于让Hubot在某个时间说话?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文