bot.py starts up.
Creating a Discord Application
1
Open the Developer Portal
Navigate to https://discord.com/developers/applications and sign in with your Discord account.
2
Create a new application
Click New Application in the top-right corner. Give it a name — this becomes the default bot username — then click Create.
3
Add a bot user
In the left sidebar, open the Bot tab. Click Add Bot and confirm. Discord creates a bot user attached to your application.
4
Copy your bot token
Under the Token section, click Reset Token, confirm the action, then copy the token that appears. This is your The bot loads this value at startup via
BOT_TOKEN.Paste it into a .env file in the project root:.env
python-dotenv:bot.py
5
Enable Message Content Intent
Still on the Bot tab, scroll down to Privileged Gateway Intents. Enable Message Content Intent.The bot code explicitly requests this intent:Without this toggle enabled in the portal, Nextcord will not receive message content events even if the intent is declared in code.
bot.py
Setting Bot Permissions
When inviting the bot to a server you must grant it the permissions it needs to function. The table below lists every required permission and why it is needed.Generating an Invite URL
1
Open the OAuth2 URL Generator
In the Developer Portal, navigate to OAuth2 → URL Generator in the left sidebar.
2
Select scopes
Under Scopes, check both:
botapplications.commands
applications.commands scope is required for Discord to register and display the slash commands that the bot syncs via bot.sync_application_commands().3
Select bot permissions
The Bot Permissions panel appears once
bot is checked. Enable:- Connect
- Speak
- Send Messages
- Embed Links
- Read Message History
4
Copy and open the generated URL
Copy the URL at the bottom of the page, paste it into a browser, select the server you want to invite the bot to, and click Authorise.
Running the Bot
With Lavalink running (see Lavalink Setup) and the.env file in place, start the bot:
What happens at startup
Theon_ready event fires once the bot has authenticated with Discord’s gateway. It performs three tasks in sequence:
bot.py
- Connects to Lavalink — creates a
wavelink.Nodepointed athttp://127.0.0.1:2333using the password defined inapplication.yml(youshallnotpass). - Registers the node pool —
wavelink.Pool.connectmakes the node available for all subsequent voice connections. - Syncs slash commands —
bot.sync_application_commands()registers all@bot.slash_commanddecorators with Discord’s API.
Global slash command registration can take up to an hour to propagate to all servers. During development, commands usually appear much faster — typically within a few minutes of the bot connecting.
Configuration Reference
Related Topics
Lavalink Setup
Run the audio server your bot connects to during startup.
Environment Variables
Confirm every value the bot expects from your .env file.
Quickstart
Use the setup steps to bring the bot up locally.
Configuration
Compare the bot, Lavalink, and permission settings in one place.