CodeDestroyer / CodeDadBot

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

CodeDad

CodeDad 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.

This README is intended to help get you started. Definitely update and improve to talk about your own instance, how to use and deploy, what functionality he has, etc!

Modifing

Running CodeDad Locally

You have to first run

% npm install

to install all dependencies of the project, after which please edit this specific file. node_modules/hubot-slack/src/slack.coffee adding this before the class declaration.

dotenv = require('dotenv')
dotenv.load()

This allows us to use .env files to hold configuration. create a .env file in the root folder and here is a sample from mine

HUBOT_SLACK_TOKEN=TOKENSTUFF
DOMAIN=http://homestead.app
HUBOT_NEWRELIC_ACCOUNT_ID=307051
HUBOT_NEWRELIC_APP_ID=4775581
HUBOT_NEWRELIC_API_KEY=049cb2be5237d9248aeb6277f28056fed9238eac807ee6b

You can test your hubot by running the following.

You can start CodeDad locally by running:

% bin/hubot --adapter slack

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 CodeDad by typing CodeDad help.

CodeDad> CodeDad help

CodeDad> 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.
...

Scripting

An example script is included at scripts/example.coffee, so check it out to get started, along with the Scripting Guide.

For many common tasks, there's a good chance someone has already one to do just the thing.

hubot-scripts

There will inevitably be functionality that everyone will want. Instead of writing it yourself, you can check hubot-scripts for existing scripts.

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.

external-scripts

Hubot is able to load scripts from third-party npm package. Check the package's documentation, but in general it is:

  1. Add the packages as dependencies into your package.json
  2. npm install to make sure those packages are installed
  3. 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.

Persistence

If you are going to use the hubot-redis-brain package (strongly suggested), you will need to add the Redis to Go addon on Heroku which requires a verified account or you can create an account at Redis to Go and manually set the REDISTOGO_URL variable.

% heroku config:add REDISTOGO_URL="..."

If you don't require any persistence feel free to remove the hubot-redis-brain from external-scripts.json and you don't need to worry about redis at all.

Adapters

Adapters are the interface to the service you want your hubot to run on. This can be something like Campfire or IRC. There are a number of third party adapters that the community have contributed. Check Hubot Adapters for the available ones.

If you would like to run a non-Campfire or shell adapter you will need to add the adapter package as a dependency to the package.json file in the dependencies section.

Once you've added the dependency and run npm install to install it you can then run hubot with the adapter.

% bin/hubot -a <adapter>

Where <adapter> is the name of your adapter without the hubot- prefix.

Restart the bot

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

About


Languages

Language:CoffeeScript 98.3%Language:Shell 1.2%Language:Batchfile 0.5%