Remind Me Script

The remind-me script (scripts/remind-me.js) contains a single handler for responding to the phrase:

hubot remind me to <task> in <sec> seconds

The script starts a timer, so that the Hubot will remind us to <task> after <sec> seconds have elapsed.

Note that this is a non-blocking script! If we ask the Hubot to remind us to dance in 3600 seconds, the Hubot will be free to help us with other tasks. Just because it’s waiting for that the 3600 seconds to elapse doesn’t mean it can’t do other things in the meantime.

How it Works

Your callback for remind me to (.+) in (\d+) seconds? should do the following:

  1. As soon as the command is issued, the hubot will reply with:

    OK. I'll remind you to <task> in <numSeconds> seconds.

    for whatever <task> and <numSeconds> are. The Hubot should be aware of grammar, such that we see 1 second for a single second and X seconds for all other X.

  2. A timeout is then set, so that the hubot will reply with the task after numSeconds seconds:

    Don't forget to <task>!