How to Create a Discord Bot Token
Step-by-step guide to creating a Discord bot application, generating a token, and inviting the bot to your server.
Before you can host your Discord bot on XGamingServer, you need to create a bot application on Discord and generate a token. The token is what allows your bot to log in to Discord.
⚠️ Warning: Never share your bot token publicly. Anyone with your token can control your bot. If your token is ever leaked, reset it immediately in the Developer Portal.
Creating Your Bot Application
Open the Discord Developer Portal
Go to https://discord.com/developers/applications and log in with your Discord account.
Create a new application
Click New Application in the top-right corner. Give your application a name (this will be your bot's default username) and click Create.
Go to the Bot section
In the left sidebar, click Bot.
Generate your bot token
If this is a brand-new application, you may see your token displayed once. Click Copy to save it.
If the token is not shown, click Reset Token and confirm. Discord will generate a new token and display it. Copy it immediately.
⚠️ Warning: You can only view your token once after generating it. If you lose it, you will need to reset it, which invalidates the old token.
Save your token somewhere safe
Paste your token into a secure location like a password manager or a private text file. You will need it when configuring your bot on the XGamingServer panel.
Configuring Gateway Intents
Gateway Intents control what events your bot receives from Discord. Some intents are considered "privileged" and must be manually enabled.
Enable privileged intents
On the Bot page, scroll down to Privileged Gateway Intents and enable the intents your bot needs:
- Presence Intent -- Required if your bot tracks user online/offline status.
- Server Members Intent -- Required if your bot needs to access the full member list or member join/leave events.
- Message Content Intent -- Required if your bot reads the content of messages (needed for prefix-based commands like
!help).
💡 Tip: If you are unsure which intents your bot needs, check the bot's documentation or README. Many modern bots using slash commands do not need the Message Content Intent.
📝 Note: Bots in 100 or more servers must be verified by Discord to use privileged intents. For most personal and small community bots, you can enable them freely.
Inviting Your Bot to a Discord Server
Go to the OAuth2 section
In the left sidebar, click OAuth2.
Select the bot scope
Under OAuth2 URL Generator, check the bot scope. If your bot uses slash commands, also check applications.commands.
Select permissions
A permissions panel will appear below. Select the permissions your bot needs. Common permissions include:
- Send Messages -- Post messages in channels.
- Read Message History -- View past messages.
- Manage Messages -- Delete or pin messages.
- Manage Roles -- Assign or remove roles from members.
- Connect / Speak -- Join and talk in voice channels (for music bots).
💡 Tip: Only grant the permissions your bot actually needs. You can always add more later by re-inviting the bot with an updated URL.
Copy the invite URL
Scroll down and copy the Generated URL.
Invite the bot
Open the URL in your browser. Select the Discord server you want to add the bot to, review the permissions, and click Authorize.
Your bot application is now set up. The bot will appear offline in your server until you deploy and start it on XGamingServer. See our Node.js, Python, or custom bot guides to get it running.
How is this guide?
Understanding Discord Bot Permissions and Intents
Learn how Discord bot permissions and Gateway Intents work, and how to configure them for your bot.
Getting Started with Discord Bot Hosting
Learn what XGamingServer Discord bot hosting provides, which server type you have, and what you need to get started.