Dark is a chat bot built on the Hubot framework.
Ask the bot for some help to get a list of available commands.
human> dark help
Once the commands are returned, try them out!
human> map me the cheese board
dark> http://maps.google.com/maps?q=the%20cheese%20board&hl=en&sll=37.0625,-95.677068&sspn=73.579623,100.371094&vpsrc=0&hnear=the%20cheese%20board&t=m&z=11
http://maps.google.com/maps/api/staticmap?markers=the%20cheese%20board&size=400x400&maptype=roadmap&sensor=false&format=png
human> directions from 600 e main street richmond, va to foo dog
dark> Directions from 600 E Main St, Richmond, VA 23219, USA to 1537 W Main St, Richmond, VA 23220, USA
1.4 mi - 6 mins
1. Head northwest on E Main St toward N 6th St (1.4 mi)
2. Turn left onto S Lombardy St - Destination will be on the left (66 ft)
http://maps.googleapis.com/maps/api/staticmap?size=400x400&path=weight:3%7Ccolor:red%7Cenc:_~bdFfwswMuc@b%7C@c@dAKp@Cb@E~LA`JAjICtGCb@Op@cAzDcFzR^P&sensor=false
human> weather 23112
dark> Weather for Beverly Hills, CA 90210, USA (Powered by DarkSky https://darksky.net/poweredby/)
Currently: Clear 33.6°C/93°F
Today: Partly cloudy starting later this afternoon, continuing until tomorrow morning.
Coming week: No precipitation throughout the week, with temperatures falling to 24°C/75°F on Thursday.
user1> dark youtube no no no cat remix
dark> http://www.youtube.com/watch?v=z7OJ3vDqyw8&feature=youtube_gdata
You must define the following environment variables
HUBOT_SLACK_TOKEN
- If running on Slack, add a bot under your team settingsHUBOT_DARK_SKY_API_KEY
- Get an API key from darksky.netHUBOT_DARK_SKY_DEFAULT_LOCATION
- Some location you want the bot to default toHUBOT_UBER_OUTPUT_FORMAT
- Accepted values aretable
(ASCII table),slack
(ASCII table preceded by code block notation) andnone
. Defaults tonone
.HUBOT_UBER_TOKEN
- Get an Uber developer tokenHUBOT_YOUTUBE_API_KEY
- Get a Google developer console tokenVIMEO_CLIENT_ID
- Get developer credentialsVIMEO_CLIENT_SECRET
VIMEO_ACCESS_TOKEN
You can test your hubot by running the following, however some plugins will not behave as expected unless the environment variables they rely upon have been set.
You can start Dark locally by running:
npm install
npm start:console
To connect to slack, instead run:
npm start
You'll see some start up output and a prompt:
[Sat Feb 28 2015 12:38:27 GMT+0000 (GMT)] INFO Using default redis on localhost:6379
Dark>
Then you can interact with Dark by typing Dark help
.
Dark> Dark help
Dark animate me <query> - The same thing as `image me`, except adds [snip]
Dark help - Displays all of the help commands that Dark knows about.
...
See the Scripting Guide.
Smaller scripts can be found in scripts/
.
Larger scripts are found on the npm registry and can included by adding
them to external-scripts.json
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 in general it is:
- Use
npm install --save
to add the package topackage.json
and install it - Add the package name to
external-scripts.json
as a double quoted string
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 those in hubot-auto-deploy
.
{
"hubot-fun": [
"crazy",
"thanks"
],
"hubot-auto-deploy": "*"
}
Be aware that not all plugins support this usage and will typically fallback to including all scripts.
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 need 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.
% heroku create --stack cedar
% git push heroku master
If your Heroku account has been verified you can run the following to enable and add the Redis to Go addon to your app.
% heroku addons:add redistogo:nano
If you run into any problems, checkout Heroku's docs.
You'll need to edit the Procfile
to set the name of your hubot.
More detailed documentation can be found on the deploying hubot onto Heroku wiki page.
If you would like to deploy to either a GNU Linux/Mac or Windows operating system. Please check out the deploying hubot onto UNIX and deploying hubot onto Windows wiki pages.
You may want to get comfortable with heroku logs
and heroku restart
if
you're having issues.