GithubHelp home page GithubHelp logo

codereviewsubmission's Introduction

CodeReviewSubmission

Discord Bot for accepting code submissions for review

Prerequisites

  • Python 3.x
  • MySQL Server
  • Docker
  • Discord account and a server with administrative privileges
  • Discord Bot

Installation

Clone the Repository

git clone https://github.com/braddotcoffee/CodeReviewSubmission
cd CodeReviewSubmission

Install Dependencies

pip install -r requirements.txt

Setup

Setting up the Discord Bot

  1. Visit the Discord Developer Portal.
  2. Create a new application and bot.
  3. Copy the bot token.
  4. Add the bot to your server by creating an OAuth2 URL with appropriate permissions.

Create a Moderator Role and Community Channel on Discord

  1. Create a moderator role in your Discord server.
  2. Add a community channel and create a forum channel within it.
  3. Create a tag in the forum channel for code review submissions.

Database Setup

  1. Install and run MySQL Server on your device.
  2. Create a new database named codereview.
  3. Create a user codereviewuser with a password.

Configuration

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.

Sync Commands

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)

Dump Tags

Create a post inside the forum channel and run /sync dumb_tags to retrieve the NewdReviewTag and replace it respectively.

Running the Bot Locally

python3 bot.py

Using Docker (Production)

Brad, I didn't try this, so I'll leave it up to you to fill this up.

codereviewsubmission's People

Contributors

braddotcoffee avatar

Stargazers

 avatar Dhextras avatar ShowierData9978 avatar

Watchers

 avatar

codereviewsubmission's Issues

Duplicate Posts & Proper Docs

Motivation

  • Occasionally the connection to the MySQL db connection breaks ( Unknown reasons ). which lead to duplicate review Post in channels. There is no proper documentation on how to get this running locally. I'm thriving to fix these and possibly learn something on the go.

Implementation

  • Apply retry logic to reconnect the db if its failed or not available when trying to create the data in the db.
  • Add proper documentation on how to get it started the project locally.

Testing

  • Implement Logic to intentionally break the connection and check if its retires to connect to db.
  • Check to make sure the same post doesn't get posted twice
  • Walk through the instruction on a new environment and check if its works

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.