Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

27 lines (25 sloc) 0.712 kB
# Description:
# Is it the day?
#
# Dependencies:
# None
#
# Configuration:
# None
#
# Commands:
# hubot is it <action> day ? - Returns if it's the day for your action
#
# Author:
# KuiKui
module.exports = (robot) ->
robot.respond /is it (\w+) day ?\?/i, (msg) ->
action = msg.match[1]
nbDay = Math.floor(new Date().getTime() / 1000 / 86400)
actionHash = action.length + action.charCodeAt(0) + action.charCodeAt(action.length - 1)
destiny = Math.cos(nbDay + actionHash) + 1
limit = (Math.sin(actionHash) + 1) / 2
if destiny > limit
msg.send "Sorry, it's not " + action + " day. But try tomorrow..."
else
msg.send "Yes, it's " + action + " day !"
Jump to Line
Something went wrong with that request. Please try again.