.env file for secrets, the Lavalink bootstrap in bot.py, and application.yml for the audio server itself. Understanding where each setting lives — and how they must stay in sync — helps you move the bot between machines or tune playback safely. For the full variable reference, see Environment Variables.
Environment Variables
The bot usespython-dotenv to load sensitive values from a .env file in the project root at startup. This keeps secrets out of source code and out of version control.
The
.env file is listed in .gitignore and should never be committed to your repository. Anyone with your bot token can control your bot and potentially abuse your Discord application.Required Variables
How to get your token:
- Go to the Discord Developer Portal
- Select your application (or create one) and open the Bot tab
- Click Reset Token to reveal a fresh token, then copy it immediately
- Paste it into your
.envfile as shown below
.env file:
Lavalink Connection (bot.py)
The bot establishes its connection to the Lavalink audio server inside theon_ready event in bot.py. The URI and password are currently hard-coded:
Running Lavalink on a remote server:
If your Lavalink node is hosted on a separate machine (for example, a VPS), update the
uri to point to that server’s IP or hostname:
2333 and that application.yml on that server uses the same password you set here.
Lavalink Server Configuration (application.yml)
Theapplication.yml file is mounted into the Lavalink Docker container and controls the audio server’s behaviour. It is located in the project root and passed to Docker via the volume definition in docker-compose.yml.
Server Settings
Authentication
password argument in bot.py. See the warning above before changing it.
Audio Sources
YouTube Plugin
YouTube support is provided by theyoutube-plugin rather than Lavalink’s built-in YouTube source, which gives more reliable access:
Memory Allocation
The Docker container is configured to allocate a maximum of 512 MB of RAM to the Java process:-Xmx1G for 1 GB).
Discord Bot Permissions
When inviting the bot to your server, grant the following permissions. All of these are required for normal operation: Voice Permissions:- Connect — allows the bot to join voice channels
- Speak — allows the bot to transmit audio into a voice channel
- Send Messages — required to post Now Playing embeds and command responses
- Embed Links — required to render rich embeds with artwork and track details
- Read Message History — required so the bot can locate and edit its persistent Now Playing message
message_content privileged intent in code:
Related Topics
Environment Variables
Review the exact .env values the bot reads at startup.
Lavalink Setup
Follow the Docker guide for the audio node that your config points to.
Bot Setup
Register and invite the Discord application that uses these settings.
Quickstart
Move from setup to a working local bot in a few minutes.