Skip to content

Creating a Discord Bot

Sayrix edited this page Apr 25, 2026 · 2 revisions

Ticket-Bot needs a Discord application, bot token, application ID, and access to your Discord server.

Create the Application

  1. Open https://discord.com/developers/applications.
  2. Click New Application.
  3. Give it a name, for example Ticket-Bot.
  4. Open the application.
  5. Copy the Application ID. This is the clientId in config/config.ts.

Create the Bot User

  1. Open the Bot page inside your application.
  2. Click Add Bot if Discord has not created one yet.
  3. Click Reset Token or View Token.
  4. Copy the token into config/.env:
DISCORD_TOKEN=your_token_here

Keep this token private. Anyone with the token can control your bot.

Gateway Intents

The current v4 code starts the gateway with:

GatewayIntentBits.Guilds

But the Message Content intent is required if you want to use the transcript features.

Invite the Bot

Open OAuth2 -> URL Generator in the Developer Portal.

Select scopes:

  • bot
  • applications.commands

For the simplest setup, select the Administrator permission.

If you do not want to use Administrator, the bot needs enough permissions to:

  • View channels.
  • Send messages.
  • Manage channels.
  • Manage roles or manage channel permission overwrites.
  • Read message history.
  • Use slash commands.
  • Embed links.
  • Attach files if your templates or future features need attachments.
  • Pin messages.

The bot validates Administrator on startup and warns when it is missing because ticket creation, channel movement, permissions, panel updates, and close flows can fail without broad permissions.

Get Discord IDs

Enable Developer Mode in Discord:

  1. Open User Settings.
  2. Go to Advanced.
  3. Enable Developer Mode.

Then right-click servers, channels, categories, roles, or users and choose Copy ID.

Common IDs used by Ticket-Bot:

  • Server ID -> guildId
  • Application ID -> clientId
  • Staff role IDs -> tickets.staffRoleIds
  • Blocked role IDs -> tickets.blockedRoleIds
  • Log channel ID -> logs.channelId
  • Ticket category IDs -> ticketTypes.*.categoryId
  • Panel channel IDs -> panels.*.channelId

Clone this wiki locally