Skip to main content

manageTicket

A Ticket Handler for simplydjs ticket system.

caution

You should use ticketSetup() before this function. Because handlers are like back-end (core), They just handle things. But ticketSetup is like front-end. without this, handlers are useless.

Implementation​

simplydjs.manageTicket(interaction, { 
// options (optional)
})

Output​

ticket channel

Types​

simplydjs.manageTicket(
button: ButtonInteraction,
options: manageTicketOptions
): Promise<DeleteResolve>

Options​

manageTicketOptions​

ParameterTypeRequiredDefaultDescription
strictboolean❌falseEnables strict mode in manageTicket
ticketnamestring❌{tag}The name of the ticket and channel that gets created
buttonsTicketButtons❌default buttonsPass a ticketButtons Object to customize embeds
pingRolesRole[]❌nonePing an admin role to let them know there is a ticket
categorystring❌noneThe category to add tickets on. This organises your server
embedCustomizableEmbed❌default embedPass a CustomizableEmbed Object to customize embeds
logChannelIdstring❌-Channel Id to send the ticket chat logs as .txt file
export type manageTicketOptions = {
ticketname?: string;
buttons?: TicketButtons;
pingRoles?: Role[];
category?: string;
embed?: CustomizableEmbed;

logChannelId?: string;
strict?: boolean;
};

TicketButtons​

ParameterTypeDescription
closeCustomizableButtonA CustomizableButton Object to customize the close button
reopenCustomizableButtonA CustomizableButton Object to customize the reopen button
deleteCustomizableButtonA CustomizableButton Object to customize the delete button
transcriptCustomizableButtonA CustomizableButton Object to customize the transcript button
export interface TicketButtons {
close: CustomizableButton;
reopen: CustomizableButton;
delete: CustomizableButton;
transcript: CustomizableButton;
}

Resolve​

DeleteResolve​

export type DeleteResolve = {
type?: 'Delete';
channelId?: string;
user?: User;
data?: AttachmentBuilder; // chat logs in .txt file
};

Example​

  • Default settings​

interactionCreate.js
const simplydjs = require('simply-djs')

simplydjs.manageTicket(interaction)
  • Customized with options​

interactionCreate.js
const simplydjs = require('simply-djs')

simplydjs.manageTicket(interaction, {
strict: true,
embed: {
title: "New ticket",
color: simplydjs.toRgb("#406dbc")
},
buttons: {

},
ticketname: "{username}",
pingRoles: ["01234567890123"],
category: "01234567890123",
logChannelId: "01234567890123"
})