This is a version of my private chatterbot, hubot on Slack. He's pretty cool.
This version is designed to be deployed on Heroku.
- Node.js
- npm
- Redis
- app.json (Recommended)
Clone this repository:
$ git clone git@github.com:Tomohiro/hubot.git
Install dependencies:
$ npm i
You can test your hubot by running the following:
$ redis &
$ bin/hubot
Then you can interact with hubot by typing hubot help
:
Hubot> hubot help
Hubot> 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.
...
Do you want to quit? Just type hubot die
:
Hubot> hubot die
Hubot> Goodbye, cruel world.
Create a Heroku app:
$ heroku create {YOUR_HUBOT_APP_NAME}
Add Redis addon:
$ heroku addons:add rediscloud
Activate the Hubot service on your "Team Services" page inside Slack and add the config variables. For example:
$ heroku config:add HUBOT_SLACK_TOKEN=xoxb-1234-5678-91011-00e4dd
Deploy and start the bot:
$ git push heroku master
$ heroku ps:scale web=1
See hubot-slack
's document.
Take a look at the scripts in the ./scripts
folder for examples.
Delete any scripts you think are useless or boring. Add whatever functionality you
want hubot to have. Read up on what you can do with hubot in the Scripting Guide.
Hubot has collection of community scripts, but it is old.
Anyway, to enable scripts from the hubot-scripts package, add the script name with
extension as a double quoted string to the hubot-scripts.json
file in this
repo.
Want to maintain the repository and package yourself? Then this added functionality maybe for you!
Hubot is now able to load scripts from new community scripts
or third-party npm
packages! To enable this functionality you can follow
the following steps.
Add the packages as dependencies into your package.json
like this:
$ npm i {package} --save
To enable third-party scripts that you've added you will need to add the package
name as a double quoted string to the external-scripts.json
file in this repo.
Push repository to Heroku:
$ git push heroku master
Or, if you want deploy this project to own heroku app, click the "Heroku Deploy" button:
You may want to get comfortable with heroku logs
and heroku restart
if you're having issues.
Restart:
$ heroku restart
tail:
$ heroku logs
Realtime monitoring:
$ heroku logs --tail
Show environment variables:
$ heroku config
Export shell friendly:
$ heroku config --shell