Ticket System Template (Discord.js v14)
This is a template for a ticket system using Discord.js v14.
Contact
Features
- Ticket - Transcripts, 2 Step Ticket Close, Reopen, Delete, Ticket Open Category, Ticket Close Category, Staff Role.
- Buttons
- Slash commands - The Template has 3 slash commands: ping, help and ticket.
- Error handling - The bot will send you a message if there is an error and it will also save the error in the error folder.
- Command handler - The bot will automatically load all commands in the commands folder.
- Event handler - The bot will automatically load all events in the events folder.
- Deploy commands - The bot will automatically deploy all commands in the commands folder.
Requirements
- Node.js v16.6.0 or newer
Installation Packages
npm init or npm init -y (if you folder name not a space or special character)
npm i discord.js
npm i @discordjs/rest
npm i colors
How to use
- Visual Code Plugin
- Download the template. Download
- Create a new application in the Discord Developer Portal click on
New Application
and give it a name. - Go to the
Bot
tab and clickAdd Bot
. - Go to the
OAuth2 - General
tab and select thein-app Authorization
in "Authorization Method". - Select the
bot
scope and theapplications.commands
scope. - Add the bot permissions "Administrator" in the
Bot Permissions
section. - Go to the
OAuth2 - URL Generator
tab and click onBot
,Applications.commands
andAdministrator
and copy the link. - Open the link in a new tab and add the bot to your server.
- Go to the
Bot
tab and copy the token. - Go to the
General Information
tab and copy the application ID. - Open the
config.json
file and paste the application ID, token, owner ID. - Run
node index.js
ornode .
in the terminal.
Config
{
"clientID": "APPICATION_ID",
"token": "TOKEN",
"ownerID": "OWNER_ID"
}
clientID
- Your application ID. Go to Discord Developer Portaltoken
- Your bot token. How to get a tokenownerID
- Your Discord ID. How to get it?
Exemple Slash commands
const { SlashCommandBuilder } = require('discord.js');
module.exports = {
data: new SlashCommandBuilder()
.setName('example')
.setDescription('Example command'),
async execute(interaction) {
await interaction.reply('Example command!');
}
}