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
Types
simplydjs.manageTicket(
button: ButtonInteraction,
options: manageTicketOptions
): Promise<DeleteResolve>
- button:
ButtonInteraction
- options:
manageTicketOptions
- Resolves:
DeleteResolve
Options
manageTicketOptions
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
strict | boolean | ❌ | false | Enables strict mode in manageTicket |
ticketname | string | ❌ | {tag} | The name of the ticket and channel that gets created |
buttons | TicketButtons | ❌ | default buttons | Pass a ticketButtons Object to customize embeds |
pingRoles | Role[] | ❌ | none | Ping an admin role to let them know there is a ticket |
category | string | ❌ | none | The category to add tickets on. This organises your server |
embed | CustomizableEmbed | ❌ | default embed | Pass a CustomizableEmbed Object to customize embeds |
logChannelId | string | ❌ | - | 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
Parameter | Type | Description |
---|---|---|
close | CustomizableButton | A CustomizableButton Object to customize the close button |
reopen | CustomizableButton | A CustomizableButton Object to customize the reopen button |
delete | CustomizableButton | A CustomizableButton Object to customize the delete button |
transcript | CustomizableButton | A 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"
})