This guide provides detailed instructions for setting up the Discord bot for the AccountME accounting system.
- Go to the Discord Developer Portal
- Log in with your Discord account if you're not already logged in
- Click the "New Application" button in the top-right corner
- Enter "AccountME" (or your preferred name) as the application name
- Accept the Discord Developer Terms of Service and Developer Policy
- Click "Create"
- In your new application, click on the "Bot" tab in the left sidebar
- Click the "Add Bot" button
- Confirm by clicking "Yes, do it!"
- Under the "TOKEN" section, click "Reset Token" (you'll need to confirm this action)
- Copy the token that appears - this is your bot's authentication token
- IMPORTANT: Keep this token secret! Anyone with this token can control your bot
- In the
.env
file of your project, replaceyour_discord_bot_token_here
with your actual token:DISCORD_TOKEN=your_actual_token_here
-
Under the "Bot" tab, configure the following settings:
- Username: Set to "AccountME" or your preferred bot name
- Icon: Upload a custom icon for your bot (optional)
- PUBLIC BOT: Toggle OFF if you don't want others to add your bot to their servers
- REQUIRES OAUTH2 CODE GRANT: Keep this OFF (unless you have specific OAuth2 requirements)
- PRESENCE INTENT: Toggle ON
- SERVER MEMBERS INTENT: Toggle ON
- MESSAGE CONTENT INTENT: Toggle ON (required for reading message content)
-
Click "Save Changes" at the bottom of the page
The bot needs specific permissions to function properly:
- Read Messages/View Channels
- Send Messages
- Embed Links
- Attach Files
- Read Message History
These permissions will be configured in the OAuth2 URL generation step.
- Click on the "OAuth2" tab in the left sidebar
- Select "URL Generator" in the sub-menu
- Under "SCOPES", check the "bot" option
- Under "BOT PERMISSIONS", check the following permissions:
- Read Messages/View Channels
- Send Messages
- Embed Links
- Attach Files
- Read Message History
- The generated URL will appear at the bottom of the page
- Copy this URL and open it in your web browser
- Select the server where you want to add the bot
- Click "Authorize"
- Complete the CAPTCHA verification if prompted
- Go to your Discord server
- Verify that the bot appears in the member list (it will initially be offline)
- Start the bot by running
python bot/main.py
in your project directory - The bot should come online in your server
- Test the bot by sending the command
!ping
in a channel where the bot has access - The bot should respond with "Pong!" and the current latency
The bot's presence (status message) is configured in the main.py
file. By default, it shows "Listening to !help", but you can customize this by modifying the following code:
# Set bot presence
await bot.change_presence(activity=discord.Activity(
type=discord.ActivityType.listening,
name=f"{COMMAND_PREFIX}help"
))
Available activity types include:
discord.ActivityType.playing
- "Playing [name]"discord.ActivityType.streaming
- "Streaming [name]"discord.ActivityType.listening
- "Listening to [name]"discord.ActivityType.watching
- "Watching [name]"discord.ActivityType.competing
- "Competing in [name]"
- Verify that the token in your
.env
file is correct - Check that you've enabled the necessary intents in the Developer Portal
- Ensure your bot has the required permissions in your server
- Check that the bot is online
- Verify that you're using the correct command prefix (default is
!
) - Ensure the bot has permission to read messages and send messages in the channel
- Check the console output for any error messages
- If the bot can't perform certain actions, verify that it has the necessary permissions
- You may need to adjust the bot's role position in your server's role hierarchy