This guide walks you through creating a Discord bot application and obtaining your bot token.
Prerequisites
- Discord Account with verified email
- Web Browser to access Discord Developer Portal
Step-by-Step Guide
1. Access Developer Portal
Visit the Discord Developer Portal
Log in with your Discord account if prompted.
2. Create New Application
- Click "New Application" (top right)
- Enter a name for your bot (e.g., "Tux" or "My Server Bot")
- Accept the Developer Terms of Service
- Click "Create"
3. Configure General Information
On the General Information tab:
- Name: Your bot's name
- Description: Brief description of what your bot does
- Icon: Upload a bot avatar (optional)
- Tags: Add relevant tags (optional)
Click "Save Changes" at the bottom.
4. Create Bot User
- Navigate to the "Bot" tab in the left sidebar
- Click "Add Bot"
- Confirm by clicking "Yes, do it!"
5. Get Your Bot Token
- In the Bot tab, find the Token section
- Click "Reset Token" (or "Copy" if first time)
- Confirm the action if prompted
- Copy the token immediately and save it securely
Token Security
Never share your bot token publicly!
- Don't commit it to Git
- Don't post it in Discord
- Don't share it with untrusted people
- If leaked, reset it immediately
6. Configure Bot Settings
Still in the Bot tab:
Public Bot
- Uncheck "Public Bot" if you only want to use it in your servers
- Check if you want others to be able to invite it
Requires OAuth2 Code Grant
- Leave unchecked (not needed for most bots)
Presence Intent
- Check if you need to track user presence (for status roles feature)
Server Members Intent
- Check - Required for Tux to see guild members
Message Content Intent
- Check - Required for prefix commands and message processing
Privileged Intents
Server Members Intent and Message Content Intent are "Privileged Intents".
For bots in 100+ servers, you'll need to verify your bot and request these intents.
7. Configure OAuth2
Navigate to "OAuth2" → "URL Generator":
Select Scopes
- ☑️
bot
- Basic bot functionality - ☑️
applications.commands
- Slash commands
Select Bot Permissions
Essential Permissions:
- ☑️ Read Messages/View Channels
- ☑️ Send Messages
- ☑️ Send Messages in Threads
- ☑️ Embed Links
- ☑️ Attach Files
- ☑️ Read Message History
- ☑️ Add Reactions
- ☑️ Use External Emojis
Moderation Permissions:
- ☑️ Manage Messages (for purge)
- ☑️ Kick Members
- ☑️ Ban Members
- ☑️ Moderate Members (for timeouts)
- ☑️ Manage Roles (for jail system)
Advanced (Optional):
- ☑️ Manage Channels (for temp VC)
- ☑️ View Audit Log (for enhanced tracking)
Copy the generated URL - you'll use this to invite your bot later.
What You'll Need
From the Developer Portal, you need:
Bot Token
Found in: Bot tab → Token section
Your token looks like:
MTIzNDU2Nzg5MDEyMzQ1Njc4OQ.GHIJK.aBcDeFgHiJkLmNoPqRsTuVwXyZ1234567890
Save this in your .env
file:
BOT_TOKEN=your_token_here
Client ID
Found in: General Information tab → Application ID
Used for:
- Generating invite URLs
- OAuth2 flows
Client Secret
Found in: OAuth2 tab → Client Secret
Usually not needed for basic bot deployment.
Security Best Practices
Token Storage
✅ Do:
- Store in
.env
file (git-ignored) - Use environment variables
- Secure file permissions (600)
- Use secrets management in production
❌ Don't:
- Commit to Git
- Share publicly
- Hardcode in source
- Share in Discord/support channels
Token Compromise
If your token is leaked:
- Immediately reset token in Developer Portal
- Update your
.env
file with new token - Restart your bot
- Review recent bot activity for suspicious actions
- Consider security review
Regenerating Token
To reset your token:
- Go to Bot tab
- Click "Reset Token"
- Confirm the action
- Copy new token
- Update your configuration
- Restart bot
Old Token Stops Working
After resetting, the old token is immediately invalidated. Update your deployment before the bot goes offline!
Permission Calculator
Use Discord's permission calculator to generate permission integers:
- Visit Discord Permissions Calculator
- Select required permissions
- Copy the permission integer
- Use in invite URL:
&permissions=YOUR_NUMBER
For Tux, recommended permissions integer: 1099511627775
Invite URL Template
https://discord.com/api/oauth2/authorize?client_id=YOUR_CLIENT_ID&permissions=1099511627775&scope=bot%20applications.commands
Replace YOUR_CLIENT_ID
with your Application ID.
Troubleshooting
Can't Create Application
Cause: Account not verified or restrictions
Solution:
- Verify your email address
- Check account standing
- Try different browser
Token Reset Doesn't Work
Cause: Browser cache or Discord issue
Solution:
- Hard refresh (Ctrl+Shift+R)
- Clear browser cache
- Try different browser
- Wait a few minutes and try again
Bot Shows Offline After Token Reset
Cause: Didn't update .env
with new token
Solution:
- Copy new token from Developer Portal
- Update
BOT_TOKEN
in.env
- Restart bot:
docker compose restart tux
"Invalid Token" Error
Cause: Token is wrong, expired, or malformed
Solution:
- Verify token is copied correctly (no spaces)
- Check for extra characters
- Reset token and try again
- Verify it's the BOT token, not client secret
Next Steps
Once you have your bot token:
- Set Up Database - Configure PostgreSQL
- Configure Environment Variables - Create
.env
file - Deploy Tux - Choose deployment method
- Invite bot to your server using the OAuth2 URL
Related Documentation
- Environment Variables - Using the bot token
- Security Best Practices - Protecting your token
- Deployment Guide - Deploying Tux
Next: Set up your database →