Skip to content

Latest commit

 

History

History
73 lines (44 loc) · 2.71 KB

README.md

File metadata and controls

73 lines (44 loc) · 2.71 KB

haxfred

haxfred is a chat bot built on the Hubot framework. It was initially generated by generator-hubot, and configured to be deployed on Heroku to get you up and running as quick as possible.

Running haxfred Locally

First, install all the npm dependencies.

nvm use
npm install

If you don't already have a hubot integration set up on slack, create one.

Next, copy the .env-example file to .env.

  • Fill in the HUBOT_SLACK_TOKEN with the token from your hubot slack integration. For development, it's recomended to use a different token then for your production instance.

You can start haxfred locally by running:

% npm start

If using a Windows machine, run:

% npm run start:windows

This will connect haxfred to slack.

Then you can interact with haxfred by logging into slack. For a list of commands, type [bot-name-here] help. The default bot name when running locally is haxfred-dev.

Scripting

To add a new script, add a new file at scripts/script-name.coffee. Then create a folder of the same name with an index.js file in scripts/script-name. The coffeescript file will require the index.js file.

Put the documentation for the script in the coffeescript file. There's a bug in the current version of hubot that requires the documentation to be in a coffeescript file.

See the scripting-docs.

external-scripts

There will inevitably be functionality that everyone will want. Instead of writing it yourself, you can use existing plugins.

Hubot is able to load plugins from third-party npm packages. This is the recommended way to add functionality to your hubot. You can get a list of available hubot plugins on [npmjs.com][npmjs] or by using npm search:

% npm search hubot-scripts panda
NAME             DESCRIPTION                        AUTHOR DATE       VERSION KEYWORDS
hubot-pandapanda a hubot script for panda responses =missu 2014-11-30 0.9.2   hubot hubot-scripts panda
...

To use a package, check the package's documentation, but in general it is:

  1. Use npm install --save to add the package to package.json and install it
  2. Add the package name to external-scripts.json as a double quoted string

You can review external-scripts.json to see what is included by default.

Deployment

To deploy, simply open a PR to this repo. Once it is merged in, it will be automatically deployed to heroku.

You may want to get comfortable with heroku logs and heroku restart if you're having issues.