Discord Bot for accepting code submissions for review
- Python 3.x
- MySQL Server
- Docker
- Discord account and a server with administrative privileges
- Discord Bot
git clone https://github.com/braddotcoffee/CodeReviewSubmission
cd CodeReviewSubmission
pip install -r requirements.txt
- Visit the Discord Developer Portal.
- Create a new application and bot.
- Copy the bot token.
- Add the bot to your server by creating an OAuth2 URL with appropriate permissions.
- Create a moderator role in your Discord server.
- Add a community channel and create a forum channel within it.
- Create a tag in the forum channel for code review submissions.
- Install and run MySQL Server on your device.
- Create a new database named
codereview
. - Create a user
codereviewuser
with a password.
Replace the placeholders in example.config.yaml
and example.secrets.yaml
with your actual data:
-
example.secrets.yaml
:Discord: Token: YOUR_DISCORD_BOT_TOKEN Database: Password: YOUR_DATABASE_PASSWORD
-
example.config.yaml
:Database: Username: codereviewuser Host: localhost # prod-db for production Name: codereview Discord: ModeratorRole: YOUR_MODERATOR_ROLE_ID CodeReview: Channel: YOUR_CODE_REVIEW_CHANNEL_ID NeedsReviewTag: YOUR_REVIEW_TAG_ID
Rename these files to config.yaml
and secrets.yaml
.
Unfortunately Discord Bot API don't automatically synchronize commands on servers joined before the bot starts running. So to manually achive that,add the provided code below the on_ready
function in bot.py
for guild in self.guilds:
await SyncController.sync_commands(self.tree, guild)
Create a post inside the forum channel and run /sync dumb_tags
to retrieve the NewdReviewTag
and replace it respectively.
python3 bot.py
Brad, I didn't try this, so I'll leave it up to you to fill this up.