A discord bot for running weight-loss challenges.
AyWeigh is a Django application. This provides a few useful features, mainly: ORM and admin.
The requirements for running the bot are getting a bot token and joining it to a server.
- Login to the Discord Developer Portal.
- Go to the Applications page and click
New Application
. - In the sidebar, click the Bot tab, click
Add Bot
, then pressYes, do it
. - Ensure the toggle for
MESSAGE CONTENT INTENT
is enabled. Make sure to save changes to the bot. - To get the bot token, click the
Reset Token
button near the top of the page. Enter MFA if required. - Once the token is visible, copy it to somewhere secure (like 1password or a secrets manager). Keep this token private.
- After getting your bot token, click on the
OAuth2
tab in your application's portal. - Click
Add Redirect
, enterlocalhost:8000
- For scopes, select
bot
andapplications.commands
- For bot permissions, select:
Manage Roles
Send Messages
Create Public Threads
Send Messages in Threads
Manage Messages
Manage Threads
Embed Links
Attach Files
Read Message History
Add Reactions
Use Slash Commands
- Next, click on the URL Generator in the sidebar under OAuth2 and select the same settings as above for scopes and permissions
- Copy the generated URL at the bottom, and navigate to it in a browser. Select the server you'd like to join it to, and finish the process.
- Once complete, the bot should appear in your selected server.
Make sure you've got the dependencies installed (typically in a virtualenv):
python -m pip install -r requirements.txt
The bot runs as two components, the bot itself, and a django application running the admin which doesn't need to run all the time.
In development, the following commands should be run simultaneously from the root of the project:
python manage.py runserver # Runs the django admin and any other endpoints
BOT_TOKEN=<token_value> python manage.py run_bot # Runs the discord bot