Skip to content

Instantly share code, notes, and snippets.

@PonDad
Created April 3, 2016 06:43
Show Gist options
  • Save PonDad/807b9d50bfc129fafed909870b2837c3 to your computer and use it in GitHub Desktop.
Save PonDad/807b9d50bfc129fafed909870b2837c3 to your computer and use it in GitHub Desktop.
hubot-scripts
# 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