Skip to content

A Discord bot + web app that tracks submissions for Black Flag Academy (a DDR Discord)'s weekly challenges

Notifications You must be signed in to change notification settings

kotutuloro/bfa-submissions

Repository files navigation

BFA Submission Bot

Under development

A discord bot that tracks submissions for Black Flag Academy's weekly challenges. Includes an admin interface for admin things. Makes heavy use of discord.py and Django.

Commands

!help - shows available commands

!submit <score> {attached photo} - Submit a score with picture for the BFA Weekly Challenge. This command requires a photo attachment to be part of the message.

!addtwitter <twitter> - Add twitter username to Student profile

!addname <ddr_name> - Add DDR name (ex. KEEKSTER) to Student profile

Faculty/Admin only

!newweek <challenge name> - Start a new weekly challenge

!close - Prevent submissions for the current challenge

!reopen - Resume submissions for the current challenge

Deployment/Management

This app is hosted on heroku at https://bfa-submissions.herokuapp.com/. Changes merged to the main branch are automatically deployed.

Configs

These can all be set via the Heroku settings dashboard for this app or using the heroku config:set cli command.

  • SECRET_KEY: Randomly generated Django secret key
  • DISCORD_BOT_TOKEN: Token for the Discord bot (for instructions on creating one, see the discord.py docs
  • SUBMISSION_CHANNEL_ID: Discord channel ID for the submissions channel

Creating an admin user

From the app's heroku dashboard:

  • Click "More" >> "Run console"
  • Enter python manage.py createsuperuser
  • From there you will be prompted to enter a username, email, and password.
    • (If you're creating an account for someone else, enter a temporary password that you can send to them later. They'll be able to change this password once they login.)

Alternatively, if you have the heroku-cli installed, you can run this from your terminal instead:

heroku run -a bfa-submissions python manage.py createsuperuser

Local Development

Instructions to run this from your local computer.

Initial Setup

Requires Python >= 3.6 and PostgreSQL

  • Clone the repo to your computer

  • Create and activate your virtual environment

  • Install dependencies

    python -m pip install -r requirements.txt
  • Create database

    createdb bfa
  • Run database migrations

    python manage.py migrate
  • Create a local superuser (you'll use these fake creds to log in to the admin site locally)

    python manage.py createsuperuser
  • Copy secrets.sample to secrets.sh

    cp secrets.sample secrets.sh

Setting up a discord bot for testing

  • Create and invite a bot account to your server

    • Follow these instructions: https://discordpy.readthedocs.io/en/stable/discord.html
    • Replace faketoken in secrets.sh with your bot's token
    • The bot will need the following permissions when you invite it to your Discord:
      • View channels
      • Send messages
      • Read message history
      • Add reactions
  • Get the ID for the specific channel you want the bot to work in

    • Right-click the channel name and select "Copy ID"
    • Replace 12345 in secrets.sh with your channel id

Running the admin interface locally

  • (Activate your virtual environment)
  • source secrets.sh && python manage.py runserver
  • Go to localhost:8000 in your browser

Running the discord bot locally

  • (Activate your virtual environment)
  • source secrets.sh && python bot.py

Running tests

  • SECRET_KEY=abc pytest

Things to do

bot stuff:

  • initial bot setup
  • add things to db on submission
  • bot testing
  • bot resume/catchup after off/on
  • auto determine student level (freshman, etc) by discord role

web stuff:

later:

  • discord commands to close/open submissions (restricted to faculty role)
  • discord command to change week (restricted to faculty role)
  • command to let students add/change their dancer name or twitter info
  • python manage.py check --deploy to look for things to change before actually hosting it
  • host on heroku
  • discord oauth for front end login? :thinkingface:
  • if the bot told you what your upscore was (if you’re replacing one) like +[x] in green
  • add reaction & reply to messages in response

refactoring / legibility

About

A Discord bot + web app that tracks submissions for Black Flag Academy (a DDR Discord)'s weekly challenges

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published