Prerequisites
- A Discord account
- Administrative access to the Discord server where you want to add the bot
Creating Your Discord Bot
Access Discord Developer Portal
Navigate to the Discord Developer PortalLog in with your Discord account if prompted.
Create New Application
Click the “New Application” button in the top right corner.Enter a name for your application (e.g., “Bot Planning” or “Schedule Bot”).Accept the Discord Developer Terms of Service and click “Create”.
Navigate to Bot Section
In the left sidebar, click on “Bot”.If you don’t see a bot user yet, click “Add Bot” and confirm by clicking “Yes, do it!”.
Get Your Bot Token
Under the bot’s username, find the “Token” section.Click “Reset Token” (or “Copy” if this is your first time).Copy the token and add it to your
.env file:Configure Bot Intents
The bot uses default intents (Scroll down to “Privileged Gateway Intents” section.You typically don’t need to enable any privileged intents for this bot, but you can enable them if needed:
bot.py:48):- Presence Intent: Not required
- Server Members Intent: Not required
- Message Content Intent: Not required (bot uses slash commands)
Generate Bot Invite URL
In the left sidebar, click on “OAuth2” → “URL Generator”.Under “Scopes”, select:
- ✅
bot - ✅
applications.commands
- ✅ Send Messages
- ✅ Attach Files (required for sending schedule images)
- ✅ Use Slash Commands
274877908992Invite Bot to Your Server
Copy the generated URL from the bottom of the URL Generator page.Paste it into your browser and select the server where you want to add the bot.Click “Authorize” and complete the captcha if prompted.
Bot Configuration Details
The bot is configured with these settings inbot.py:48-49:
Slash Command Registration
The bot automatically syncs slash commands when it starts (bot.py:362-369):
Slash commands may take up to 1 hour to appear globally. For immediate testing, you can sync to a specific guild (server) by modifying the sync code.
Available Commands
Once configured, your bot will have the following slash command:/planning
Displays the schedule for the current week or a specific date. Usage:date(optional): Date in DD-MM-YYYY format to view that week’s schedule
Troubleshooting
Bot appears offline
Check your token:- Ensure
DISCORD_TOKENin.envmatches the token from Discord Developer Portal - Verify there are no extra spaces or quotes
- Try resetting the token in the Developer Portal
- Verify
bot.run(TOKEN)is being called (bot.py:371) - Check for errors in the console output
Slash commands not appearing
Wait for sync:- Global slash commands can take up to 1 hour to propagate
- Try restarting Discord client
- Verify console shows ”✅ Slash commands synchronisées”
- Check for sync errors in console output
- Ensure bot has “Use Slash Commands” permission in the server
- Verify bot was invited with
applications.commandsscope
Bot can’t send images
Missing permissions:- Bot needs “Attach Files” permission
- Check channel-specific permission overrides
- Verify
EDT_PATHenvironment variable is set correctly - Test the CSV URL in a browser
- Ensure Google Sheets is publicly accessible
Security Best Practices
-
Keep token secure:
- Store in
.envfile only - Add
.envto.gitignore - Never log or print the token
- Store in
-
Reset if compromised:
- If your token is exposed, immediately reset it in Discord Developer Portal
- Update your
.envfile with the new token - Restart your bot
-
Minimal permissions:
- Only grant permissions the bot actually needs
- Review permissions periodically
Next Steps
Once your bot is set up and running:- Configure your Google Sheets with schedule data
- Test the
/planningcommand in your Discord server - Invite users to start using the bot