NOTE djs-ticketsystem v3 is in beta
DJS-TicketSystem is a package designed to make creating "tickets" in discord servers easier
npm install djs-ticketsystem
Here is an example on how to setup your bot with the ticket system.
You can also use require, for example const { TicketSystem } = require('djs-ticketsystem');
import { TicketSystem } from 'djs-ticketsystem';
import { Intents, Client } from 'discord.js';
const client = new Client({
intents: [Intents.FLAGS.GUILDS, Intents.FLAGS.GUILD_MESSAGES],
});
const tickets = new TicketSystem(client, {});
client.login();
Below is an example of how you can create a ticket, you always have to pass in owner
and guild
but you can also pass in any option for GuildChannelCreateOptions
client.on('messageCreate', async (message) => {
if (message.content == '-new') {
const ticket = await tickets.create({
owner: message.member,
guild: message.guild
})
}
});
Once a ticket channel is created you can do some methods on it:
<ticket>.owner
This returns a GuildMember who is the ticket ownerThere also some methods and properties on tickets
<tickets>.isTicket(channel: TicketChannelResolvable)
This allows you to check if a channel is a ticket or not by passing in a TicketChannelResolvable
<tickets>.tickets
This is a cached manager like you are used to with GuildChannelManager for example, you can view more info here
Generated using TypeDoc