Installing Ballsdex without Docker - Ballsdex-Team/BallsDex-DiscordBot GitHub Wiki
The recommended way to run Ballsdex is using Docker, but you may have reasons to run it without this dependency.
This install method is supported but only recommended for the advanced users, there are a lot of additional steps and dependencies to manage yourself.
[!NOTE] Few commands will be given, but online guides are given instead. This is because instructions differ between operating systems, so you have to use what's best for you.
1. Setting up the database
Install PostgreSQL and start it. Create a database by following this guide.
You must then have a link to connect to the database in the following format: postgres://username:password@localhost:5432/database_name
Test that your database is up with the following command: psql -c "\l" postgres://username:password@localhost:5432/database_name
Check that your database appears in the list and that your user is the owner.
2. Requirements
Python 3.13
You must have the latest version of Python installed on your system. Given that it's new, it's unlikely that your system ships with the right Python version (check with python3.13 -V
).
On Linux/macOS, pyenv is a good tool for compiling any python version. You can also search instructions for your system to download pre-built binaries.
Check that you also have access to pip with python3.13 -m pip -V
Poetry
You also need poetry, our package manager, to install the dependencies.
Run python3.13 -m pip install -U poetry
to install it.
git
Git is needed to download and update the source code.
Create a Discord bot account
You must first setup a Discord bot account. You can follow discord.py's tutorial to create and invite your bot.
For now, don't copy your token, but keep the page open.
Once this is configured, you also need to enable message content intent. Go to the "Bot" tab of your application, scroll down to "Privileged intents" and tick "Message content".
[!TIP] You can fill the description of your application, it will appear under the "About me" section.
3. Download the source code
Type the following command to download the latest version of the bot:
git clone https://github.com/laggron42/BallsDex-DiscordBot.git
Then you can use the command cd to change directory and open the folder you just downloaded:
cd BallsDex-DiscordBot
4. Installing the bot
poetry install
to download and install the bot's dependencies.poetry shell
to open the virtual environment where your dependencies arepython3 -m ballsdex --version
to check that the bot loads successfullypython3 -m ballsdex --reset-settings
to create the default configuration filecd admin_panel
python3 manage.py migrate
to initialize the databasepython3 manage.py collectstatic --no-input
to initialize the admin panelcd ..
(return to the previous directory for the next steps)
5. Configure the bot
Follow this section from the main tutorial to fill the base settings.
6. Run the bot
Before running the bot, you must tell it about your database. Export the BALLSDEXBOT_DB_URL
environment variable with the link to Postgres you tested earlier:
- Linux/macOS:
export BALLSDEXBOT_DB_URL=postgres://username:password@localhost:5432/database_name
- Windows:
$Env.BALLSDEXBOT_DB_URL = 'postgres://username:password@localhost:5432/database_name'
Then, run python3 -m ballsdex
to start the bot! To shut it down, type Ctrl+C.
[!TIP] There are multiple options available when running the bot, do
python3 -m ballsdex -h
to view them.
Running the admin panel
- Open another shell with
poetry shell
enabled and the environment variables exported cd admin_panel && uvicorn admin_panel.asgi:application
- Follow this guide afterwards
Summary
Before running any command, do these:
cd BallsDex-DiscordBot
(open the bot's directory)poetry shell
(activate the virtual environment)export BALLSDEXBOT_DB_URL=postgres://username:password@localhost:5432/database_name
Then
- Start the bot:
python3 -m ballsdex
- Start the admin panel:
cd admin_panel && uvicorn admin_panel.asgi:application
Updating the bot
git pull
poetry install
to update dependenciescd admin_panel
python3 manage.py migrate
python3 manage.py collectstatic --no-input
- Restart the bot and admin panel