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
# Generates commands to track days since an event | |
# | |
# it's been <number> days since <event> - Set the day when the event happened | |
# <event> on <date> - Set the date the event happened (yyyy-mm-dd) | |
# how long since <event>? - Display the number of days since the event | |
module.exports = (robot) -> | |
robot.respond /(.*?) on ((19|20)\d\d[- /.](0[1-9]|1[012])[- /.](0[1-9]|[12][0-9]|3[01]))/, (msg) -> | |
event = msg.match[1] | |
date = new Date(msg.match[2]) |