Before the bot can connect to Discord it must be registered as an application in the Discord Developer Portal. Registration gives you a unique bot account, the token used to authenticate the bot when it starts, and the OAuth2 invite link you use to add the bot to your server. This guide covers every step from creating the application to granting the bot the permissions it needs to manage ticket channels.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/astrxnomo/discord-ticket-bot-py/llms.txt
Use this file to discover all available pages before exploring further.
Create an Application
- Go to https://discord.com/developers/applications and log in with your Discord account.
- Click New Application in the top-right corner.
- Enter a name for your application (e.g.
Ticket Bot) and click Create.
Add a Bot Account
- In the left-hand sidebar, click Bot.
- Click Add Bot, then confirm by clicking Yes, do it!
- Optionally update the bot’s username and upload a custom avatar to match your server’s branding.
Enable Privileged Intents
Still on the Bot tab, scroll down to the Privileged Gateway Intents section and enable the following two intents:
- Server Members Intent — required for the bot to read guild member data (used when building the watching-members status on startup).
- Message Content Intent — required for the bot to read message content and respond to prefix commands such as
tb!ticket.
Get Your Bot Token
- On the Bot tab, click Reset Token and confirm the action.
- Copy the token that appears. You will paste it into
main/main.pyin the Configuration step.
Invite Your Bot to Your Server
- In the left-hand sidebar, navigate to OAuth2 → URL Generator.
-
Under Scopes, select:
bot
-
Under Bot Permissions, select the following permissions (all of which the bot uses at runtime):
Permission Why it’s needed Manage Channels Creates and deletes ticket channels Send Messages Posts ticket embeds and notifications Read Messages / View Channels Reads commands and button interactions Embed Links Sends rich embed messages Attach Files Allows file attachments within tickets Read Message History Accesses previous messages in ticket channels Manage Messages Deletes the original command message after tb!ticketAdd Reactions Granted to users and staff within ticket channels Mention Everyone Pings the staff role when a user calls for help - Scroll to the bottom of the page and copy the generated invite URL.
- Paste the URL into your browser, select the server you want to add the bot to, and click Authorize.
The bot requires either Administrator permission or all of the specific permissions listed in Step 5 to function correctly. If you prefer to use Administrator for simplicity during development, select that permission in the URL Generator instead. For production servers, granting only the minimum required permissions is strongly recommended.
main/main.py.
Configuration
Set your category ID, logs channel ID, staff role ID, embed color, and bot token.