v1.0.0
A squire for your D&D Slack Team
This bot uses Google Cloud Platforms Cloud Functions to answer players' most frequent questions. For ease of maintenance, these answers are powered by a Google Sheet the DM can keep up-to-date.
Currently, the bot supports:
/xp
to display current XP, level, and XP needed to level up next/tldr [optional date]
to display a summary of the last session (or a summary of any date)/whois list
to list out all the important NPCs they've encountered/whois [name]
to search a list of NPCs to display a reminder for who a given NPC is
- Set up your Google Cloud Platform project
- Go to the GCP Resource Manager and create a new project or select an existing one
- Make note of the region and Project ID
- Enable Billing on the project (top-left hamburger menu >
Billing
) - Enable the Google Cloud Function and Google Sheets API
- Set up your local development environment for GCP
- If you haven't installed it before, install the GCloud SDK
- Update your glocud components and install beta components:
gcloud components update && gcloud components install beta
- Set up your Slack app
- Create a new app in your Slack team
- On the left sidebar menu, click
Basic Information
- Make note of the Verification Token Generated (you'll be able to return to this page later, don't worry)
- Set up the Google Sheets CSV
- Make a copy of the example DM workbook
- On Sheets, click
File > Publish to the web
- In the dropdown, select
Log
andCSV
- Click
Publish
and copy the URL generated - Repeat Steps 3&4 for each of the
tldr
andwhois
sheets
- Clone this repository into a directory on your local machine:
git clone https://github.com/drunken-economist/dm-slack-bot
- Navigate into the cloned directory:
cd dm-slack-bot/functions
- Edit the config.json file in your favorite text editor (or using the commands below)
- Replace
"SLACK_TOKEN": "YOUR_SLACK_TOKEN"
with the Verification Token generated in Step 3.3 above:
sed -i 's/YOUR_SLACK_TOKEN/xof2-464564574-24576736-idgfsdfklue' config.json
- For each of the CSV URLs, replace the example URL with the appropriate URL from Step 4.4 in Initial Setup
- Replace
- Deploy the functions:
gcloud beta functions deploy xp --runtime python37 --trigger-http
gcloud beta functions deploy tldr --runtime python37 --trigger-http
gcloud beta functions deploy whois --runtime python37 --trigger-http
- Make note of the
httpsTrigger
that is returned when you deploy
- Navigate to you the Slash Command setup screen
- Go to your Slack Apps
- Select the app your created in Step 3 of Initial Setup
- On the left sidebar, click
Slash Commands
- Add the command configuration:
- For Command, enter
/xp
, or whatever command you want to summon the bot for this function - For Request URL. enter
https://YOUR_REGION-YOUR_PROJECT_ID.cloudfunctions.net/xp
, replacing with the URL from Step 5 of Deploying the Cloud Functions - For Short Description, enter
return the current XP
(this tells users what our command does) - You can leave Usage Hint blank, or add more explainer text
- Repeat the above for each command you want to support
- For Command, enter