Created
April 3, 2016 06:40
-
-
Save PonDad/9c22087cd600b510e043610cc25d3dc0 to your computer and use it in GitHub Desktop.
hubot-scripts
This file contains hidden or 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: | |
# 日報. | |
# | |
# 時刻を受け取ってYYYY-mm-dd形式で返す | |
toYmdDate = (date) -> | |
Y = date.getFullYear() | |
m = ('0' + (date.getMonth() + 1)).slice(-2) | |
d = ('0' + date.getDate()).slice(-2) | |
return "#{Y}-#{m}-#{d}" | |
cronJob = require('cron').CronJob | |
module.exports = (robot) -> | |
new cronJob | |
cronTime: "0 0 7 * * 1-5" | |
onTick: -> | |
date = new Date | |
robot.send {room: "general"}, "today : #{toYmdDate(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