Skip to content

Instantly share code, notes, and snippets.

@PonDad
Created April 3, 2016 06:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save PonDad/9c22087cd600b510e043610cc25d3dc0 to your computer and use it in GitHub Desktop.
Save PonDad/9c22087cd600b510e043610cc25d3dc0 to your computer and use it in GitHub Desktop.
hubot-scripts
# 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