Created
April 3, 2016 06:43
-
-
Save PonDad/807b9d50bfc129fafed909870b2837c3 to your computer and use it in GitHub Desktop.
hubot-scripts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Description: | |
# 時報. | |
# | |
# Commands: | |
# 時刻を受け取ってhh:mm形式で返す | |
tohhmmTime = (date) -> | |
hh = ('0' + date.getHours()).slice(-2) | |
mm = ('0' + date.getMinutes()).slice(-2) | |
return "#{hh}:#{mm}" | |
cronJob = require('cron').CronJob | |
module.exports = (robot) -> | |
new cronJob | |
cronTime: "*/60 * * * *" | |
onTick: -> | |
date = new Date | |
robot.send {room: "general"}, "time : #{tohhmmTime(date)}." | |
return | |
start: true | |
timeZone: "Asia/Tokyo" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment