Discord bot for assigning roles based on the groups a user belongs to in Google Workspace
- Clone the repository
- Install Docker Desktop
- Create a
.envfile in the root directory of the project with the following content:DGWA_GOOGLE_CLIENT_SECRETS=<JSON_CREDENTIAL_CONTENTS> DGWA_DISCORD_BOT_TOKEN=<DISCORD_BOT_TOKEN> # Local for development DGWA_GOOGLE_AUTH_REDIRECT_URI=http://127.0.0.1:5000 # Will get sent a message when auth token needs to be refreshed DGWA_ADMIN_USER_ID=<DISCORD_USER_ID> # Optional, defaults shown DGWA_TOKEN_FILE=group_read_token.json
- Run the bot with
docker compose up DGWA-botordocker compose up -d DGWA-botto run in the background
The bot should already be hosted in /opt/DGWA on the server, but if something happened to it, here is a general outline of how to set it up.
- Get access to our project in Google Cloud Platform
- Download the OAuth 2.0 credentials for "Discord Bot" as a JSON file
- Get access to our Discord Developer Portal Team
- Generate a new bot token for the Discord bot
- Copy
.env.exampleto.envand fill in the necessary values - Make sure
discord-auth.robotiklubi.eepoints to the server where the bot will be hosted - Run the bot with
docker compose up -d - Optionally use
docker-compose-dgwa.service.exampleto make the bot start on boot - Use a reverse proxy to route traffic from
discord-auth.robotiklubi.eeto the Python server running on port 5000