Notorious B.O.T. is a chat bot built on the Hubot framework. It was initially generated by generator-hubot
, and configured to be deployed on Heroku.
There is a Hubot Scripts org with tons of existing scripts.
- Install with npm:
npm install hubot-shipit --save
- Add
"hubot-shipit"
to the array inexternal-scripts.json
Custom scripts go in the scripts
folder. They don't have to be written in CoffeeScript. An example script is included at scripts/example.coffee
, so check it out to get started, along with the Scripting Guide.
- Write new script, such as
scripts/awesome.coffee
- Add
awesome
tohubot-scripts.json
??
The following environmental variables are needed. These should already be installed on Heroku, and some you don't need locally, depending on what you are testing.
export REDISTOGO_URL=XXX
- Redis backend so that the bot remembers things. Heroku add-on.
export HUBOT_SLACK_TOKEN=XXXX
- Slack API token. Found at the Slack Hubot config page.
export HEROKU_URL=http://notoriousbot.herokuapp.com/
- So the bot knows where to talk to.
export HUBOT_HEROKU_KEEPALIVE_URL=$(heroku apps:info -s | grep web_url | cut -d= -f2)
- A simple mechanism so Heroku doesn't go to sleep
export HUBOT_GOOGLE_CALENDAR_ID=XXXX && export HUBOT_GOOGLE_CALENDAR_CLIENT_ID=XXXX && export HUBOT_GOOGLE_CALENDAR_CLIENT_SECRET=XXXX && export HUBOT_GOOGLE_CALENDAR_REFRESH_TOKEN=XXXX
- Config for Hangouts scripts. See
hangouts.coffee
for details.
- Config for Hangouts scripts. See
- For Chartbeat integration:
- Default site:
export HUBOT_CHARTBEAT_SITE=example.com
- All available sites
export HUBOT_CHARTBEAT_SITES=example1.com,example2.com
- API key:
export HUBOT_CHARTBEAT_API_KEY=XXXXXXXXXXXXXXXX
- Default site:
- Calculon (Spark Core) integration:
- Spark Core device ID:
export CALCULON_DEVICE_ID=XXXXXX
- Access token is with the account that has claimed the device:
export CALCULON_ACCESS_TOKEN=XXXXXX
- API key for Forecast.io for checking current weather temp:
export CALCULON_FORECAST_IO_KEY=XXXX
- Location to look for temperature:
export CALCULON_LOCATION=12.345,67.890
- Spark Core device ID:
You can start NotoriousBOT locally by running:
bin/hubot -n NotoriousBOT
OR
npm run local
You'll see some start up output about where your scripts come from and a prompt:
[Sun, 04 Dec 2011 18:41:11 GMT] INFO Loading adapter shell
[Sun, 04 Dec 2011 18:41:11 GMT] INFO Loading scripts from /home/tomb/Development/hubot/scripts
[Sun, 04 Dec 2011 18:41:11 GMT] INFO Loading scripts from /home/tomb/Development/hubot/src/scripts
Hubot>
Then you can interact with NotoriousBOT by typing NotoriousBOT help
.
NotoriousBOT> NotoriousBOT help
NotoriousBOT> animate me <query> - The same thing as `image me`, except adds a few
convert me <expression> to <units> - Convert expression to given units.
help - Displays all of the help commands that Hubot knows about.
...
This should already be done
heroku create --stack cedar
git push heroku master
heroku addons:add redistogo:nano
Add the environment variables (see Configuration above) to Heroku
heroku config:set HEROKU_URL=XXXX
If adding new scripts with new configuration, you will need to send to Heroku.
heroku config:set NEWTHING=XXXXXX
heroku config:set HUBOT_HEROKU_KEEPALIVE_URL=$(heroku apps:info -s | grep web_url | cut -d= -f2)
heroku restart