Rolld - RPG-dice Slack integration
Rolld is a Slack Integration that makes it easy to roll dice in a Slack Channel. That’s really all there is to it. I put this thing together in a few hours downtime when I needed to take a break from writing the book. I don’t plan to distribute it via Slack because I don’t want the dozens (there are dozens of us!) of Slack gamers banging on my free-tier Heroku dyno. But you can deploy your own Rolld app to a Heroku dyno and integrate it into a Slack channel of your choosing.

Usage
Roll + modifiers. Roll results are broken down inside the [] brackets and modifier is appended with a +.

Rolld also supports multiple rolls, eg: /roll 2d6

Steps to Setup your own Rolld App
Steps to set up this integration for your local Slack channel, using a free dyno on Heroku to host:
- Clone the repo:
git clone git@github.com:JaredHalpern/Rolld.git - Make sure you have Homebrew installed. If not:
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
Heroku Setup
- Install the Heroku CLI:
brew install heroku/brew/heroku - Verify Heroku CLI installation:Should show something like:
heroku --versionheroku/7.0.35 (darwin-x64) node-v10.0.0 - Ensure you’ve created an account at https://www.heroku.com (free tier works)
- Login to Heroku via command line:
heroku login - Change to the cloned Rolld directory:
cd Rolld - Set the Heroku buildpack:
heroku buildpacks:set heroku/python - Create a heroku app:
heroku create(we’ll configure Slack to point to this URL soon) - Verify the remote is set up:
git remote -vYou should see something like:heroku https://git.heroku.com/yass-rangers-61413.git (fetch) heroku https://git.heroku.com/yass-rangers-61413.git (push) - Go to Heroku Settings and find the Domain. Note down this URL for the next step.
Create a Slack App
- Log into your Slack account via the web: https://api.slack.com/apps
- Hit the Create New App button
- Name the app and choose a workspace in which to deploy it
- In the
Add features and functionalitySection, ClickSlash Commands - Hit the
Create New Commandbutton - Enter the Command you’d like to use to invoke the integration.
/rollseems natural - In Request URL, use the url from your Heroku app
- Hit the Save button in the lower right
- In the Install your app to your workspace section, hit the
Install App to Workspacebutton
Verification / Permissioning
On the Basic Information page, copy the
Verification Tokenand save it temporarilyClick on OAuth & Permissions on the left-hand side. Copy the OAuth token and save it temporarily
To get the Team-ID: navigate to your team’s Slack channel in a web browser, right-click and inspect the source. Find the text
team_idand grab the value (something likeZ4KRT3F6A)Set the environmental variables in Heroku. Go to your app’s Settings and tap
Reveal Config Vars. Enter these Key-Value pairs:SLACK_VERIFICATION_TOKEN| value from step 1SLACK_ROLLD_TOKEN| value from step 2SLACK_TEAM_ID| value from step 3
Alternatively, use the Heroku CLI:
heroku config:set SLACK_VERIFICATION_TOKEN=....your token....
Deploy
- Push to the Heroku remote:
git push heroku master - Open Slack, and run your command!
/roll 1d20
I’ve probably missed a step or two. If you see something, feel free to file a PR and I’ll update. Thanks!
Development and Testing
- Use ngrok for testing locally via “tunneling”
- Instructions to set up ngrok specifically to test a Slack bot are here
- Command:
ngrok http 5000 - Ensure local ENV variables are set - either in
.bashrcor temporarily - Create a
virtualenvfor Rolld and run:/Rolld/bin/activate - With the activated
virtualenv, run:python app.py - Copy the url from ngrok’s Forwarding field to the
Request URLfield in your Slack app’s Slash Commands settings - When done testing, don’t forget to set the Request URL back to your Heroku App’s URL
Useful links
Credits
Thanks to Justin Isaf (jisaf on GitHub) for adding modifiers and The Light of the Spoon™ for testing it.