/rpg-bot

A hubot to help play D&D on Slack

Primary LanguageJavaScript

rpg-bot

rpg-bot is a Slack 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. You can find general instructions on how to setup a hubot instance at those pages.

To setup rpg-bot, git clone an instance of this code to your local machine, and initialize a local git repo. Then follow the specific instructions to deploy a hubot instance to Heroky using the slack adapter.

Specific instructions for features unique to rpg-bot can be found below.

Persistence

rpg-bot requires the hubot-redis-brain package for many of it's features. 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="..."

Adapters

rpg-bot is designed to run with Slack. Make sure to run through the slack adapter configuration instructions. In particular, don't forget to confiugure the HUBOT_SLACK_TOKEN system variable.

rpg-bot specific configuration

Roll command

To use rpg-bot's /roll command, you will need to create a new "Slash Command" integration at Slack. The token defined there should be saved in an environment variable named "HUBOT_SLASH_ROLL_TOKEN".

export HUBOT_SLASH_ROLL_TOKEN=[your token here]

Assuming you're deploying to Heroku, set the URL for the Slash Command to https://[YOUR APP NAME HERE].herokuapp.com/hubot/roll

You can find instructions on how to use the /roll command by running /roll help within Slack.

combat script

To use the /combat script, you'll need to create another "Slash Command" integration. Again, assuming you're deploying to Heroku, set the URL to https://[YOUR APP NAME HERE].herokuapp.com/hubot/combat.

Run /combat help in Slack to see usage options.

Campaign summarizer

rpg-bot can monitor a channel in which you're playing your campaign, stip out any meta conversation, and publish the results to a separate 'archive' channel. The archive channel can then be read by the DM or players to get a summary of recent events (without the extraneous in-game chatter).

You'll need to setup three environment variables:

RPGBOT_SUMMARIZE_INTERVAL: The time in minutes between each run of the bot. Defaults to 0 which turns the summarizer off. We recommend setting this to a value of around 15. That gives players a chance to edit any in-character messages, and shouldn't tax the system too much.

RPGBOT_SUMMARY_CHANNEL_NAME: Set this to the name of the channel you want the summaries posted to. Do not prefix the name with a "#" character.

RPGBOT_CAMPAIGN_CHANNEL_NAME: Set this to the name of the channel you want summarized. Do not prefix the name with a "#" character.

To use the summarizer, the following conventions must be followed:

  • The script will ignore any message starting with > We recommend using > in Slack for all meta-game conversations
  • The script ignores all files.
  • The script ignores all system messages
  • The script strips out messages containing urls
  • The script will save any text with 1 or 3 backticks, italicized text, or with the /me command.
  • If you're also using rpg-bot's combat script, the script will save combat start and end messages (but nothing in between)
  • Any message that doesn't fit into one of the above situations is discarded by default.