Discord integration for witchdice.com
It allows users to subscribe a Discord channel to a Witchdice room using /join-room ROOMNAME
, see their current room with /current-room
, and leave a room with /leave-room
Initial implementation by Shotch.
Invite with permissions link: https://discord.com/api/oauth2/authorize?client_id=937850556272226374&permissions=67584&scope=bot%20applications.commands
Development app: https://discord.com/api/oauth2/authorize?client_id=947213521056321648&permissions=67584&scope=bot%20applications.commands
- node index.js
- open discord channel with the development bot invited
- tell that bot to listen to a room if it's not already
- open that room on witchdice.com and make rolls
- make modifications and restart the node server to see them
Comment/uncomment the guild-specific or global command publishing lines in deploy-commands.js (highly recommend developing on a specific guild; the global commands take up to an hour to propogate.)
node deploy-commands.js
pm2 logs
- Merge
deployed
branch tomain
. - SSH into the cloud
- cd witchdice-discord-bot
- pm2 kill
- git checkout deployed
- git pull
- pm2 start index.js
- Clone repo
- Run
npm install
- Add Discord credentials in a
.env
file (cat > .env
, then paste in) - Add config.json as outlined below
- Add firebase_auth.json as outlined below
cat > room.json
, then put in empty brackets:{}
- Run
node index.js
- Interact with your Discord bot via your web browser
DISCORD_TOKEN=BOT TOKEN HERE
GOOGLE_APPLICATION_CREDENTIALS=./firebase_auth.json
{
"clientId": "DISCORD CLIENT ID HERE",
"guildId": "DEV GUILD HERE",
"token": "BOT TOKEN HERE"
}
{
"type": "service_account",
"project_id": "roll-to-hit",
"private_key_id": "",
"private_key": "",
"client_email": "",
"client_id": "",
"auth_uri": "",
"token_uri": "",
"auth_provider_x509_cert_url": "",
"client_x509_cert_url": ""
}
sudo apt-get -y update
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh | bash
source ~/.bashrc
nvm install v16.13.2
git clone https://github.com/wickworks/witchdice-discord-bot.git
< follow the below installation steps >
sudo npm install -g pm2
cd witchdice-discord-bot
git checkout deployed
git pull
pm2 start index.js
pm2 save