Message scheduler for hubot
npm install hubot-schedule

hubot-schedule is a message scheduler runs on hubot.
It allows you to schedule a message in both cron-style and datetime-based format pattern.
It is for time-based scheduling, not interval-based scheduling.
Since hubot-schedule uses node-schedule to manage schedule, some of the cron features are not supported.
Please see node-schedule for more details.
This script is greatly inspired by hubot-cron.
At first, I wanted a datetime-based scheduler.
As I start developing this, I noticed that node-schedule also suppports cron-style scheduling, so I changed my mind to develop a scheduler that supports both cron-style and datetime-based format.
If you are using slack adapter such as hubot-slack, please use v4.2.2 or later.v4.2.1 sometimes fails to add new schedule.
Add hubot-schedule to your package.json.
```
"dependencies": {
"hubot-schedule": "~0.7.0"
}
Run npm install.
``
$ npm install
Add hubot-schedule to external-scripts.json.
``
> cat external-scripts.json
> ["hubot-schedule"]
`
Hubot> hubot help schedule
Hubot schedule [add|new] "
Hubot schedule [add|new] "
Hubot schedule [add|new] #
Hubot schedule [add|new] #
Hubot schedule [cancel|del|delete|remove]
Hubot schedule [upd|update]
Hubot schedule env - Show hubot schedule environments
Hubot schedule list #
Hubot schedule list - List all scheduled messages for current room
Hubot schedule list all - List all scheduled messages for any rooms
Hubot> hubot schedule add "2015-01-16 10:00" Let's release this script!
6738: Schedule created
Hubot> hubot schedule add "0 10 1-5" Don't forget to brew coffee :)
9735: Schedule created
Hubot> hubot schedule list
6738: [ 2015-01-16 10:00:00 +09:00 ] #Shell Let's release this script!
9735: [ 0 10 1-5 ] #Shell Don't forget to brew coffee :)
Hubot> hubot schedule update 6738 Let's release this module and share with everyone!
6738: Scheduled message updated
Hubot> hubot schedule list
6738: [ 2015-01-16 10:00:00 +09:00 ] #Shell Let's release this script and share with everyone!
9735: [ 0 10 1-5 ] #Shell Don't forget to brew coffee :)
Let's release this script and share with everyone!
(Hubot posts the message at 2015-01-16 10:00:00 and schedule will be removed automatically)
Hubot> hubot schedule del 9735
9735: Schedule canceled
Hubot> hubot schedule list
Message is not scheduled
Hubot> hubot schedule add "0 10 1-5" hubot image me coffee
9735: Schedule created
(hubot can process messages sent by hubot-schedule, so you can ask hubot to do something at the scheduled time, like post an image of coffee.)
`
If you need to persist scheduled messages, use hubot-brain persistent module like hubot-redis-brain.
If OS timezone is set to Asia/Tokyo(UTC Offset would be "+09:00")
`
Hubot> hubot schedule env
DEBUG = false
DONT_RECEIVE = false
DENY_EXTERNAL_CONTROL = false
LIST_REPLACE_TEXT = {"@":"[@]"}
DEFAULT_UTC_OFFSET_FOR_CRON = "+09:00"
Hubot> hubot schedule add "2019-08-05 10:00 +02:00" use UTC Offset for datetime-based format pattern
2914: Schedule created
Hubot> hubot schedule add "0 10 1-5, +02:00" use UTC Offset for cron-style format pattern
4291: Schedule created
Hubot> hubot schedule list
2914: [ 2019-08-05 17:00:00 +09:00 ] #Shell use UTC Offset for datetime-based format pattern (listed schedules are shown using OS timezone)
4291: [ 0 10 1-5, +02:00 ] #Shell use UTC Offset for cron-style format pattern
`
Setting environment variable HUBOT_SCHEDULE_DEBUG=1 will show some debug messages.
Setting environment variable HUBOT_SCHEDULE_DENY_EXTERNAL_CONTROL=1 will deny schedule control from other rooms.
Setting environment variable HUBOT_SCHEDULE_DONT_RECEIVE=1 will disable hubot not to process messages sent by hubot-schedule.
Setting environment variable HUBOT_SCHEDULE_LIST_REPLACE_TEXT=' will configure the text replacement used when listing scheduled messages.'{"@":"[@]"}'
Default configuration is .
Setting environment variable HUBOT_SCHEDULE_UTC_OFFSET_FOR_CRON='
If not set, OS timezone's offset would be used.
Copyright 2015 Masakazu Matsushita.
Licensed under the MIT License.