Skip to content

Our favorite bot, named after the man who started it all.

Notifications You must be signed in to change notification settings

coreatcu/kevinzhang

Repository files navigation

kevinzhang, CORE's Slackbot

kevinzhang is a chat bot built on the Hubot framework for use on the CORE Slack. It was initially generated by generator-hubot.

Functionality

  • <name>++
  • <name>--
  • alot - Shows a picture of an alot
  • kevinzhang bottom <amount>
  • kevinzhang card 2 - Displays two answers for questions with two blanks
  • kevinzhang card me - Displays an answer
  • kevinzhang eightball <query> - Ask the magic eight ball a question
  • kevinzhang encourage all
  • kevinzhang encourage me
  • kevinzhang encourage <name>
  • kevinzhang erase <user> [<reason>]
  • kevinzhang help - Displays all of the help commands that kevinzhang knows.
  • kevinzhang help <query> - Displays all help commands that match <query>.
  • kevinzhang i am working on <anything> - Set what you're working on
  • kevinzhang insult <name> - give <name> the what-for
  • kevinzhang kitten bomb me <number> - Many, many kittens!
  • kevinzhang kitten me - A randomly selected kitten
  • kevinzhang kitten me <w>x<h> - A kitten of the given size
  • kevinzhang map me <query> - Returns a map view of the area returned by query.
  • kevinzhang pug bomb <N> - get N pugs
  • kevinzhang pug me - Receive a pug
  • kevinzhang q card - Returns a question
  • kevinzhang score <name> [for <reason>]
  • kevinzhang tell <recipients> <some message> - tell <recipients> <some message> next time they are present.
  • kevinzhang the rules - Make sure kevinzhang still knows the rules.
  • kevinzhang top <amount>
  • kevinzhang what is everyone working on? - Find out what everyone is working on
  • kevinzhang who's on call - Returns name of person on call and person on backup
  • ship it - Display a motivation squirrel

Running kevinzhang Locally

You can test kevinzhang by running the instructions below. However, not all plugins will behave as expected unless the environment variables they rely upon have been set.

You can start kevinzhang locally by running:

$ bin/hubot

You'll see some initial output and a prompt:

[Sat Feb 28 2015 12:38:27 GMT+0000 (GMT)] INFO Using default redis on localhost:6379
kevinzhang>

Then you can interact with kevinzhang by typing kevinzhang help, which will show the different queries available.

kevinzhang> kevinzhang help

Configuration

A few scripts (including some installed by default) require environment variables to be set as a simple form of configuration.

Each script should have a commented header which contains a "Configuration" section that explains which values it requires to be placed in which variable. The following shell command can be used as a shortcut to help you configure the bot.

grep -o 'hubot-[a-z0-9_-]\+' external-scripts.json | \
  xargs -n1 -I {} sh -c 'sed -n "/^# Configuration/,/^#$/ s/^/{} /p" \
      $(find node_modules/{}/ -name "*.coffee")' | \
    awk -F '#' '{ printf "%-25s %s\n", $1, $2 }'

Scripting

An example script is included at scripts/example.coffee, so check it out to get started, along with the Scripting Guide. We've written our own script as well, scripts/oncall.coffee, and plan to write more for specific functions!

External Scripts

Lots of functions already exist, so we use existing scripts instead of writing our own. Hubot is able to load plugins from third-party npm packages. That's is the recommended way to add functionality to the hubot. You can get a list of available hubot plugins on npmjs.com 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 it's usually:

  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
Advanced Usage

It is also possible to define external-scripts.json as an object to explicitly specify which scripts from a package should be included. The example below, for example, will only activate two of the six available scripts inside the hubot-fun plugin, but all four of the ones in hubot-auto-deploy.

{
  "hubot-fun": [
    "crazy",
    "thanks"
  ],
  "hubot-auto-deploy": "*"
}

Persistence

We use the hubot-redis-brain package for persistence, which means that we need the Redis to Go add-on for Heroku.

Deployment

$ git push heroku master

If you run into any problems, check out Heroku's [docs][heroku-node-docs]. More detailed documentation can be found on the [deploying hubot onto Heroku][deploy-heroku] wiki page.

About

Our favorite bot, named after the man who started it all.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published