How to Set Up a Ticket Bot on Discord (Self-Hosted, 2026)
Once a Discord server grows past a few hundred members, support questions start drowning in #general. A ticket bot fixes that: members open a private channel with your support team, you handle the issue, you close it. This guide walks you through the setup, compares hosted and self-hosted bots, and shows what to look for in ticket bot source code.
What a ticket bot does
A ticket system on Discord usually works like this:
- A member runs a command or clicks a button: "open ticket".
- The bot creates a private channel only that member and your support role can see.
- Your team helps in that channel.
- Someone closes the ticket, and the channel is archived or deleted.
Optional extras: a panel with one button per topic, private threads instead of channels, claim buttons, transcripts in a log channel.
Hosted ticket bot or self-hosted?
| Hosted public bot | Self-hosted bot (source code) | |
|---|---|---|
| Setup time | Minutes | About an hour |
| Cost | Free tier, extras often paid monthly | One-time code price + hosting |
| Who sees ticket content | The bot's operator | Only you |
| Custom features | Whatever the settings offer | Anything you code |
| Branding | Their bot name and avatar | Your own bot name and avatar |
If you want something running in five minutes, a hosted bot is fine. If you want your own branded bot, private ticket data and no subscription, self-host.
Before you start
You'll need:
- A Discord server where you have Manage Server permission.
- A support role (for example "Support") for the people who answer tickets.
- A place to run the bot: your own PC for testing, a small VPS or a home server for 24/7.
- Node.js or Docker installed on that machine.
Step 1: Create the bot application
- Open the Discord Developer Portal and click New Application.
- Name it (this is the name members will see), then open the Bot tab.
- Click Reset Token and copy the token. Treat it like a password: never post it, never commit it to Git.
Step 2: Invite the bot with the right permissions
In the portal, open OAuth2 → URL Generator and select the scopes bot and applications.commands (slash commands need the second one). For bot permissions, a ticket bot typically needs:
- View Channels and Send Messages
- Manage Channels (to create and delete ticket channels)
- Create Private Threads and Send Messages in Threads, if you use threads instead of channels
- Read Message History
Open the generated URL, choose your server and authorize. Give the bot role only what it needs; Administrator is convenient but unnecessary.
Step 3: Configure and start the bot
With self-hosted source code, configuration usually lives in an .env file:
- Copy
.env.exampleto.env. - Add the bot token, your server ID and the ID of your support role. (Turn on Developer Mode in Discord settings to copy IDs with a right-click.)
- Register the slash commands. Use a test server first; server-scoped commands appear instantly.
- Start the bot with
docker runornpm startand check that it shows as online.
Step 4: Test the full ticket flow
Use a second account, or ask a friend:
- Open a ticket. Does a private channel appear?
- Can the member and the support role see it, and nobody else?
- Close the ticket. Is the channel removed and the ticket marked closed?
- If you use transcripts: does the transcript land in the log channel, and only there?
Step 5: Tell members how to use it
Post a short message in #support or #rules: "Need help? Click a button in the ticket panel." Pin it. Most "the bot doesn't work" reports come from people who never saw the command.
Discord's Developer Policy also requires bot developers to give users a way to report issues with the bot, so add a contact line to the bot's profile.
How a private ticket channel works in code
The core of every ticket bot is a channel that @everyone can't see. With discord.js 14 you set that through permission overwrites when you create the channel (per the discord.js guide on permissions):
import { ChannelType, PermissionsBitField } from "discord.js";
const channel = await interaction.guild!.channels.create({
name: `ticket-${interaction.user.username}`,
type: ChannelType.GuildText,
permissionOverwrites: [
{ id: interaction.guild!.id, deny: [PermissionsBitField.Flags.ViewChannel] }, // @everyone
{ id: interaction.user.id, allow: [PermissionsBitField.Flags.ViewChannel] },
{ id: STAFF_ROLE_ID, allow: [PermissionsBitField.Flags.ViewChannel] },
],
});The guild ID doubles as the ID of the @everyone role. That's why the first overwrite hides the channel from everyone else.
What to look for in ticket bot source code
Searching for "discord ticket bot source code" turns up lots of free GitHub projects. Before you pick one, free or paid, check:
- Maintained library version. discord.js v14 or a current equivalent.
- Slash commands, not old prefix commands like
!ticket. - Permission overwrites done right. The ticket channel must hide from @everyone.
- A Dockerfile and
.env.example. Fewer surprises when you deploy. - Automated tests and a README that takes you from ZIP to a running bot.
- A clear license. Can you use it on a friend's server? Modify it?
Build it on a starter instead
The Discord Ticket Bot Starter is a self-hosted ticket bot in TypeScript for your own private or community server. Per the product page it has a /ticket panel with up to 5 topics and a reason prompt, private ticket channels or threads, claim by staff, close with a confirmation step, HTML/text transcripts (can be switched off, auto-deleted after 30 days by default), a per-user limit and cooldown, DE/EN messages, SQLite and a Dockerfile, plus automated tests. Requirements: Node.js 22.13 or newer (or Docker), your own bot token and your own hosting. Price: €19 incl. VAT. Not affiliated with Discord Inc. Would rather code the /ticket commands yourself? The Discord Bot Starter (€19) gives you the slash-command basics. Licence: personal, non-commercial use; run it only on non-commercial Discord servers (hobby or community servers are fine) (licence).
Running a bigger server with scam problems too? Add the Anti-Scam Bot (€25 incl. VAT).
Common problems and fixes
- Slash commands don't appear: the bot was invited without
applications.commands, or global commands haven't propagated yet. Re-invite, or register on your test server. - "Missing Permissions" error: the bot's role is below the roles it needs to manage, or lacks Manage Channels. Move the bot role higher.
- Members can't see their ticket: check the channel's permission overwrites for that member.
- Bot goes offline at night: it's running on your PC. Move it to a VPS.
FAQ
Is the Ticket Bot Starter a subscription?
No. €19 incl. VAT, paid once, delivered as a ZIP. You host it yourself.
Do I need to code to set up a ticket bot?
Not for the basics. With source code you edit an .env file and start the bot. You only need to code for custom features.
Channels or threads for tickets?
Both keep tickets private. Channels stay visible in the sidebar; private threads keep the channel list short. The Ticket Bot Starter supports both.
Can I use the Ticket Bot Starter on my shop's or company's server?
No. The licence covers personal, non-commercial use on private and community servers only, not shops, businesses or servers with paid memberships/roles (licence).
Can I set up a ticket bot on mobile?
You can use it from the mobile app, but creating the bot application and running self-hosted code works best on a computer.
Related guides
Start your own bot
Your own bot. Your own data. No monthly fee.
→ Get the Ticket Bot Starter for €19
_Not affiliated with or endorsed by Discord Inc. "Discord" is a trademark of Discord Inc._