PineaFan | 0d06edc | 2023-01-17 22:10:31 +0000 | [diff] [blame] | 1 | import { LoadingEmbed } from "../../utils/defaults.js"; |
pineafan | 6702cef | 2022-06-13 17:52:37 +0100 | [diff] [blame] | 2 | import getEmojiByName from "../../utils/getEmojiByName.js"; |
pineafan | 4edb776 | 2022-06-26 19:21:04 +0100 | [diff] [blame] | 3 | import EmojiEmbed from "../../utils/generateEmojiEmbed.js"; |
pineafan | 6702cef | 2022-06-13 17:52:37 +0100 | [diff] [blame] | 4 | import confirmationMessage from "../../utils/confirmationMessage.js"; |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 5 | import Discord, { |
| 6 | CommandInteraction, |
| 7 | GuildChannel, |
| 8 | Message, |
TheCodedProf | 21c0859 | 2022-09-13 14:14:43 -0400 | [diff] [blame] | 9 | ActionRowBuilder, |
TheCodedProf | 21c0859 | 2022-09-13 14:14:43 -0400 | [diff] [blame] | 10 | ButtonBuilder, |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 11 | MessageComponentInteraction, |
TheCodedProf | a16d167 | 2023-01-18 18:58:34 -0500 | [diff] [blame] | 12 | StringSelectMenuBuilder, |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 13 | Role, |
TheCodedProf | a16d167 | 2023-01-18 18:58:34 -0500 | [diff] [blame] | 14 | StringSelectMenuInteraction, |
TheCodedProf | 59772f8 | 2023-01-18 22:17:16 -0500 | [diff] [blame] | 15 | ButtonStyle, |
| 16 | TextInputBuilder, |
| 17 | ButtonComponent, |
| 18 | StringSelectMenuComponent, |
| 19 | ModalSubmitInteraction, |
| 20 | APIMessageComponentEmoji |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 21 | } from "discord.js"; |
TheCodedProf | 59772f8 | 2023-01-18 22:17:16 -0500 | [diff] [blame] | 22 | import { SlashCommandSubcommandBuilder, StringSelectMenuOptionBuilder } from "@discordjs/builders"; |
Skyler Grey | c634e2b | 2022-08-06 17:50:48 +0100 | [diff] [blame] | 23 | import { ChannelType } from "discord-api-types/v9"; |
pineafan | 6702cef | 2022-06-13 17:52:37 +0100 | [diff] [blame] | 24 | import client from "../../utils/client.js"; |
Skyler Grey | 11236ba | 2022-08-08 21:13:33 +0100 | [diff] [blame] | 25 | import { toHexInteger, toHexArray, tickets as ticketTypes } from "../../utils/calculate.js"; |
pineafan | 63fc5e2 | 2022-08-04 22:04:10 +0100 | [diff] [blame] | 26 | import { capitalize } from "../../utils/generateKeyValueList.js"; |
pineafan | 6702cef | 2022-06-13 17:52:37 +0100 | [diff] [blame] | 27 | import { modalInteractionCollector } from "../../utils/dualCollector.js"; |
pineafan | 3a02ea3 | 2022-08-11 21:35:04 +0100 | [diff] [blame] | 28 | import type { GuildConfig } from "../../utils/database.js"; |
pineafan | 4f164f3 | 2022-02-26 22:07:12 +0000 | [diff] [blame] | 29 | |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 30 | const command = (builder: SlashCommandSubcommandBuilder) => |
| 31 | builder |
| 32 | .setName("tickets") |
Skyler Grey | 11236ba | 2022-08-08 21:13:33 +0100 | [diff] [blame] | 33 | .setDescription("Shows settings for tickets | Use no arguments to manage custom types") |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 34 | .addStringOption((option) => |
| 35 | option |
| 36 | .setName("enabled") |
| 37 | .setDescription("If users should be able to create tickets") |
| 38 | .setRequired(false) |
PineaFan | 64486c4 | 2022-12-28 09:21:04 +0000 | [diff] [blame] | 39 | .addChoices( |
| 40 | {name: "Yes", value: "yes"}, |
| 41 | {name: "No",value: "no"} |
| 42 | ) |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 43 | ) |
| 44 | .addChannelOption((option) => |
| 45 | option |
| 46 | .setName("category") |
| 47 | .setDescription("The category where tickets are created") |
PineaFan | 64486c4 | 2022-12-28 09:21:04 +0000 | [diff] [blame] | 48 | .addChannelTypes(ChannelType.GuildCategory) |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 49 | .setRequired(false) |
| 50 | ) |
| 51 | .addNumberOption((option) => |
| 52 | option |
| 53 | .setName("maxticketsperuser") |
Skyler Grey | 11236ba | 2022-08-08 21:13:33 +0100 | [diff] [blame] | 54 | .setDescription("The maximum amount of tickets a user can create | Default: 5") |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 55 | .setRequired(false) |
| 56 | .setMinValue(1) |
| 57 | ) |
| 58 | .addRoleOption((option) => |
| 59 | option |
| 60 | .setName("supportrole") |
| 61 | .setDescription( |
| 62 | "This role will have view access to all tickets and will be pinged when a ticket is created" |
| 63 | ) |
| 64 | .setRequired(false) |
| 65 | ); |
pineafan | 4f164f3 | 2022-02-26 22:07:12 +0000 | [diff] [blame] | 66 | |
pineafan | 3a02ea3 | 2022-08-11 21:35:04 +0100 | [diff] [blame] | 67 | const callback = async (interaction: CommandInteraction): Promise<unknown> => { |
PineaFan | a00db1b | 2023-01-02 15:32:54 +0000 | [diff] [blame] | 68 | if (!interaction.guild) return; |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 69 | let m = (await interaction.reply({ |
| 70 | embeds: LoadingEmbed, |
| 71 | ephemeral: true, |
| 72 | fetchReply: true |
| 73 | })) as Message; |
pineafan | 63fc5e2 | 2022-08-04 22:04:10 +0100 | [diff] [blame] | 74 | const options = { |
TheCodedProf | a16d167 | 2023-01-18 18:58:34 -0500 | [diff] [blame] | 75 | enabled: (interaction.options.get("enabled")?.value as string).startsWith("yes") as boolean | null, |
PineaFan | 638eb13 | 2023-01-19 10:41:22 +0000 | [diff] [blame] | 76 | category: interaction.options.get("category")?.channel as Discord.CategoryChannel | null, |
| 77 | maxtickets: interaction.options.get("maxticketsperuser")?.value as number | null, |
| 78 | supportping: interaction.options.get("supportrole")?.role as Role | null |
pineafan | 63fc5e2 | 2022-08-04 22:04:10 +0100 | [diff] [blame] | 79 | }; |
Skyler Grey | 11236ba | 2022-08-08 21:13:33 +0100 | [diff] [blame] | 80 | if (options.enabled !== null || options.category || options.maxtickets || options.supportping) { |
pineafan | 6702cef | 2022-06-13 17:52:37 +0100 | [diff] [blame] | 81 | if (options.category) { |
pineafan | 3a02ea3 | 2022-08-11 21:35:04 +0100 | [diff] [blame] | 82 | let channel: GuildChannel | null; |
pineafan | 6702cef | 2022-06-13 17:52:37 +0100 | [diff] [blame] | 83 | try { |
TheCodedProf | 59772f8 | 2023-01-18 22:17:16 -0500 | [diff] [blame] | 84 | channel = await interaction.guild.channels.fetch(options.category.id) as GuildChannel; |
pineafan | 6702cef | 2022-06-13 17:52:37 +0100 | [diff] [blame] | 85 | } catch { |
| 86 | return await interaction.editReply({ |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 87 | embeds: [ |
| 88 | new EmojiEmbed() |
| 89 | .setEmoji("CHANNEL.TEXT.DELETE") |
| 90 | .setTitle("Tickets > Category") |
Skyler Grey | 11236ba | 2022-08-08 21:13:33 +0100 | [diff] [blame] | 91 | .setDescription("The channel you provided is not a valid category") |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 92 | .setStatus("Danger") |
pineafan | 6702cef | 2022-06-13 17:52:37 +0100 | [diff] [blame] | 93 | ] |
pineafan | 63fc5e2 | 2022-08-04 22:04:10 +0100 | [diff] [blame] | 94 | }); |
pineafan | 6702cef | 2022-06-13 17:52:37 +0100 | [diff] [blame] | 95 | } |
pineafan | 63fc5e2 | 2022-08-04 22:04:10 +0100 | [diff] [blame] | 96 | channel = channel as Discord.CategoryChannel; |
PineaFan | a00db1b | 2023-01-02 15:32:54 +0000 | [diff] [blame] | 97 | if (channel.guild.id !== interaction.guild.id) |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 98 | return interaction.editReply({ |
| 99 | embeds: [ |
| 100 | new EmojiEmbed() |
| 101 | .setTitle("Tickets > Category") |
Skyler Grey | 11236ba | 2022-08-08 21:13:33 +0100 | [diff] [blame] | 102 | .setDescription("You must choose a category in this server") |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 103 | .setStatus("Danger") |
| 104 | .setEmoji("CHANNEL.TEXT.DELETE") |
| 105 | ] |
| 106 | }); |
pineafan | 6702cef | 2022-06-13 17:52:37 +0100 | [diff] [blame] | 107 | } |
| 108 | if (options.maxtickets) { |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 109 | if (options.maxtickets < 1) |
| 110 | return interaction.editReply({ |
| 111 | embeds: [ |
| 112 | new EmojiEmbed() |
| 113 | .setTitle("Tickets > Max Tickets") |
Skyler Grey | 11236ba | 2022-08-08 21:13:33 +0100 | [diff] [blame] | 114 | .setDescription("You must choose a number greater than 0") |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 115 | .setStatus("Danger") |
| 116 | .setEmoji("CHANNEL.TEXT.DELETE") |
| 117 | ] |
| 118 | }); |
pineafan | 6702cef | 2022-06-13 17:52:37 +0100 | [diff] [blame] | 119 | } |
pineafan | 3a02ea3 | 2022-08-11 21:35:04 +0100 | [diff] [blame] | 120 | let role: Role | null; |
pineafan | 6702cef | 2022-06-13 17:52:37 +0100 | [diff] [blame] | 121 | if (options.supportping) { |
| 122 | try { |
PineaFan | a00db1b | 2023-01-02 15:32:54 +0000 | [diff] [blame] | 123 | role = await interaction.guild.roles.fetch(options.supportping.id); |
pineafan | 6702cef | 2022-06-13 17:52:37 +0100 | [diff] [blame] | 124 | } catch { |
| 125 | return await interaction.editReply({ |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 126 | embeds: [ |
| 127 | new EmojiEmbed() |
| 128 | .setEmoji("GUILD.ROLE.DELETE") |
| 129 | .setTitle("Tickets > Support Ping") |
Skyler Grey | 11236ba | 2022-08-08 21:13:33 +0100 | [diff] [blame] | 130 | .setDescription("The role you provided is not a valid role") |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 131 | .setStatus("Danger") |
pineafan | 6702cef | 2022-06-13 17:52:37 +0100 | [diff] [blame] | 132 | ] |
pineafan | 63fc5e2 | 2022-08-04 22:04:10 +0100 | [diff] [blame] | 133 | }); |
pineafan | 6702cef | 2022-06-13 17:52:37 +0100 | [diff] [blame] | 134 | } |
pineafan | 3a02ea3 | 2022-08-11 21:35:04 +0100 | [diff] [blame] | 135 | if (!role) return; |
pineafan | 63fc5e2 | 2022-08-04 22:04:10 +0100 | [diff] [blame] | 136 | role = role as Discord.Role; |
PineaFan | a00db1b | 2023-01-02 15:32:54 +0000 | [diff] [blame] | 137 | if (role.guild.id !== interaction.guild.id) |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 138 | return interaction.editReply({ |
| 139 | embeds: [ |
| 140 | new EmojiEmbed() |
| 141 | .setTitle("Tickets > Support Ping") |
Skyler Grey | 11236ba | 2022-08-08 21:13:33 +0100 | [diff] [blame] | 142 | .setDescription("You must choose a role in this server") |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 143 | .setStatus("Danger") |
| 144 | .setEmoji("GUILD.ROLE.DELETE") |
| 145 | ] |
| 146 | }); |
pineafan | 6702cef | 2022-06-13 17:52:37 +0100 | [diff] [blame] | 147 | } |
| 148 | |
pineafan | 63fc5e2 | 2022-08-04 22:04:10 +0100 | [diff] [blame] | 149 | const confirmation = await new confirmationMessage(interaction) |
TheCodedProf | 59772f8 | 2023-01-18 22:17:16 -0500 | [diff] [blame] | 150 | .setEmoji("GUILD.TICKET.ARCHIVED") |
pineafan | 6702cef | 2022-06-13 17:52:37 +0100 | [diff] [blame] | 151 | .setTitle("Tickets") |
| 152 | .setDescription( |
Skyler Grey | 11236ba | 2022-08-08 21:13:33 +0100 | [diff] [blame] | 153 | (options.category ? `**Category:** ${options.category.name}\n` : "") + |
| 154 | (options.maxtickets ? `**Max Tickets:** ${options.maxtickets}\n` : "") + |
| 155 | (options.supportping ? `**Support Ping:** ${options.supportping.name}\n` : "") + |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 156 | (options.enabled !== null |
| 157 | ? `**Enabled:** ${ |
pineafan | 62ce192 | 2022-08-25 20:34:45 +0100 | [diff] [blame] | 158 | options.enabled |
| 159 | ? `${getEmojiByName("CONTROL.TICK")} Yes` |
| 160 | : `${getEmojiByName("CONTROL.CROSS")} No` |
| 161 | }\n` |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 162 | : "") + |
| 163 | "\nAre you sure you want to apply these settings?" |
pineafan | 6702cef | 2022-06-13 17:52:37 +0100 | [diff] [blame] | 164 | ) |
| 165 | .setColor("Warning") |
PineaFan | 5d98a4b | 2023-01-19 16:15:47 +0000 | [diff] [blame] | 166 | .setFailedMessage("No changes were made", "Success", "GUILD.TICKET.OPEN") |
pineafan | 6702cef | 2022-06-13 17:52:37 +0100 | [diff] [blame] | 167 | .setInverted(true) |
pineafan | 63fc5e2 | 2022-08-04 22:04:10 +0100 | [diff] [blame] | 168 | .send(true); |
| 169 | if (confirmation.cancelled) return; |
pineafan | 6702cef | 2022-06-13 17:52:37 +0100 | [diff] [blame] | 170 | if (confirmation.success) { |
pineafan | 3a02ea3 | 2022-08-11 21:35:04 +0100 | [diff] [blame] | 171 | const toUpdate: Record<string, string | boolean | number> = {}; |
Skyler Grey | 11236ba | 2022-08-08 21:13:33 +0100 | [diff] [blame] | 172 | if (options.enabled !== null) toUpdate["tickets.enabled"] = options.enabled; |
| 173 | if (options.category) toUpdate["tickets.category"] = options.category.id; |
| 174 | if (options.maxtickets) toUpdate["tickets.maxTickets"] = options.maxtickets; |
| 175 | if (options.supportping) toUpdate["tickets.supportRole"] = options.supportping.id; |
pineafan | 6702cef | 2022-06-13 17:52:37 +0100 | [diff] [blame] | 176 | try { |
PineaFan | a00db1b | 2023-01-02 15:32:54 +0000 | [diff] [blame] | 177 | await client.database.guilds.write(interaction.guild.id, toUpdate); |
pineafan | 6702cef | 2022-06-13 17:52:37 +0100 | [diff] [blame] | 178 | } catch (e) { |
| 179 | return interaction.editReply({ |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 180 | embeds: [ |
| 181 | new EmojiEmbed() |
| 182 | .setTitle("Tickets") |
Skyler Grey | 11236ba | 2022-08-08 21:13:33 +0100 | [diff] [blame] | 183 | .setDescription("Something went wrong and the staff notifications channel could not be set") |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 184 | .setStatus("Danger") |
| 185 | .setEmoji("GUILD.TICKET.DELETE") |
| 186 | ], |
| 187 | components: [] |
pineafan | 6702cef | 2022-06-13 17:52:37 +0100 | [diff] [blame] | 188 | }); |
| 189 | } |
| 190 | } else { |
| 191 | return interaction.editReply({ |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 192 | embeds: [ |
| 193 | new EmojiEmbed() |
| 194 | .setTitle("Tickets") |
| 195 | .setDescription("No changes were made") |
| 196 | .setStatus("Success") |
| 197 | .setEmoji("GUILD.TICKET.OPEN") |
| 198 | ], |
| 199 | components: [] |
pineafan | 6702cef | 2022-06-13 17:52:37 +0100 | [diff] [blame] | 200 | }); |
| 201 | } |
| 202 | } |
PineaFan | 638eb13 | 2023-01-19 10:41:22 +0000 | [diff] [blame] | 203 | const data = await client.database.guilds.read(interaction.guild.id); |
| 204 | data.tickets.customTypes = (data.tickets.customTypes ?? []).filter( |
Skyler Grey | 11236ba | 2022-08-08 21:13:33 +0100 | [diff] [blame] | 205 | (value: string, index: number, array: string[]) => array.indexOf(value) === index |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 206 | ); |
pineafan | 6702cef | 2022-06-13 17:52:37 +0100 | [diff] [blame] | 207 | let lastClicked = ""; |
PineaFan | 638eb13 | 2023-01-19 10:41:22 +0000 | [diff] [blame] | 208 | const embed: EmojiEmbed = new EmojiEmbed(); |
| 209 | const compiledData = { |
pineafan | 6702cef | 2022-06-13 17:52:37 +0100 | [diff] [blame] | 210 | enabled: data.tickets.enabled, |
| 211 | category: data.tickets.category, |
| 212 | maxTickets: data.tickets.maxTickets, |
| 213 | supportRole: data.tickets.supportRole, |
| 214 | useCustom: data.tickets.useCustom, |
| 215 | types: data.tickets.types, |
PineaFan | 638eb13 | 2023-01-19 10:41:22 +0000 | [diff] [blame] | 216 | customTypes: data.tickets.customTypes as string[] | null |
pineafan | 63fc5e2 | 2022-08-04 22:04:10 +0100 | [diff] [blame] | 217 | }; |
Skyler Grey | ad00217 | 2022-08-16 18:48:26 +0100 | [diff] [blame] | 218 | let timedOut = false; |
| 219 | while (!timedOut) { |
TheCodedProf | 59772f8 | 2023-01-18 22:17:16 -0500 | [diff] [blame] | 220 | embed |
pineafan | 6702cef | 2022-06-13 17:52:37 +0100 | [diff] [blame] | 221 | .setTitle("Tickets") |
| 222 | .setDescription( |
TheCodedProf | 59772f8 | 2023-01-18 22:17:16 -0500 | [diff] [blame] | 223 | `${compiledData.enabled ? "" : getEmojiByName("TICKETS.REPORT")} **Enabled:** ${ |
| 224 | compiledData.enabled ? `${getEmojiByName("CONTROL.TICK")} Yes` : `${getEmojiByName("CONTROL.CROSS")} No` |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 225 | }\n` + |
TheCodedProf | 59772f8 | 2023-01-18 22:17:16 -0500 | [diff] [blame] | 226 | `${compiledData.category ? "" : getEmojiByName("TICKETS.REPORT")} **Category:** ${ |
| 227 | compiledData.category ? `<#${compiledData.category}>` : "*None set*" |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 228 | }\n` + |
TheCodedProf | 59772f8 | 2023-01-18 22:17:16 -0500 | [diff] [blame] | 229 | `**Max Tickets:** ${compiledData.maxTickets ? compiledData.maxTickets : "*No limit*"}\n` + |
| 230 | `**Support Ping:** ${compiledData.supportRole ? `<@&${compiledData.supportRole}>` : "*None set*"}\n\n` + |
| 231 | (compiledData.useCustom && compiledData.customTypes === null ? `${getEmojiByName("TICKETS.REPORT")} ` : "") + |
| 232 | `${compiledData.useCustom ? "Custom" : "Default"} types in use` + |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 233 | "\n\n" + |
Skyler Grey | 11236ba | 2022-08-08 21:13:33 +0100 | [diff] [blame] | 234 | `${getEmojiByName("TICKETS.REPORT")} *Indicates a setting stopping tickets from being used*` |
pineafan | 6702cef | 2022-06-13 17:52:37 +0100 | [diff] [blame] | 235 | ) |
| 236 | .setStatus("Success") |
pineafan | 63fc5e2 | 2022-08-04 22:04:10 +0100 | [diff] [blame] | 237 | .setEmoji("GUILD.TICKET.OPEN"); |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 238 | m = (await interaction.editReply({ |
| 239 | embeds: [embed], |
| 240 | components: [ |
TheCodedProf | 59772f8 | 2023-01-18 22:17:16 -0500 | [diff] [blame] | 241 | new ActionRowBuilder<ButtonBuilder>().addComponents([ |
TheCodedProf | 21c0859 | 2022-09-13 14:14:43 -0400 | [diff] [blame] | 242 | new ButtonBuilder() |
TheCodedProf | 59772f8 | 2023-01-18 22:17:16 -0500 | [diff] [blame] | 243 | .setLabel("Tickets " + (compiledData.enabled ? "enabled" : "disabled")) |
| 244 | .setEmoji(getEmojiByName("CONTROL." + (compiledData.enabled ? "TICK" : "CROSS"), "id")) |
| 245 | .setStyle(compiledData.enabled ? ButtonStyle.Success : ButtonStyle.Danger) |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 246 | .setCustomId("enabled"), |
TheCodedProf | 21c0859 | 2022-09-13 14:14:43 -0400 | [diff] [blame] | 247 | new ButtonBuilder() |
Skyler Grey | 11236ba | 2022-08-08 21:13:33 +0100 | [diff] [blame] | 248 | .setLabel(lastClicked === "cat" ? "Click again to confirm" : "Clear category") |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 249 | .setEmoji(getEmojiByName("CONTROL.CROSS", "id")) |
TheCodedProf | 21c0859 | 2022-09-13 14:14:43 -0400 | [diff] [blame] | 250 | .setStyle(ButtonStyle.Danger) |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 251 | .setCustomId("clearCategory") |
TheCodedProf | 59772f8 | 2023-01-18 22:17:16 -0500 | [diff] [blame] | 252 | .setDisabled(compiledData.category === null), |
TheCodedProf | 21c0859 | 2022-09-13 14:14:43 -0400 | [diff] [blame] | 253 | new ButtonBuilder() |
Skyler Grey | 11236ba | 2022-08-08 21:13:33 +0100 | [diff] [blame] | 254 | .setLabel(lastClicked === "max" ? "Click again to confirm" : "Reset max tickets") |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 255 | .setEmoji(getEmojiByName("CONTROL.CROSS", "id")) |
TheCodedProf | 21c0859 | 2022-09-13 14:14:43 -0400 | [diff] [blame] | 256 | .setStyle(ButtonStyle.Danger) |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 257 | .setCustomId("clearMaxTickets") |
TheCodedProf | 59772f8 | 2023-01-18 22:17:16 -0500 | [diff] [blame] | 258 | .setDisabled(compiledData.maxTickets === 5), |
TheCodedProf | 21c0859 | 2022-09-13 14:14:43 -0400 | [diff] [blame] | 259 | new ButtonBuilder() |
Skyler Grey | 11236ba | 2022-08-08 21:13:33 +0100 | [diff] [blame] | 260 | .setLabel(lastClicked === "sup" ? "Click again to confirm" : "Clear support ping") |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 261 | .setEmoji(getEmojiByName("CONTROL.CROSS", "id")) |
TheCodedProf | 21c0859 | 2022-09-13 14:14:43 -0400 | [diff] [blame] | 262 | .setStyle(ButtonStyle.Danger) |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 263 | .setCustomId("clearSupportPing") |
TheCodedProf | 59772f8 | 2023-01-18 22:17:16 -0500 | [diff] [blame] | 264 | .setDisabled(compiledData.supportRole === null) |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 265 | ]), |
TheCodedProf | 59772f8 | 2023-01-18 22:17:16 -0500 | [diff] [blame] | 266 | new ActionRowBuilder<ButtonBuilder>().addComponents([ |
TheCodedProf | 21c0859 | 2022-09-13 14:14:43 -0400 | [diff] [blame] | 267 | new ButtonBuilder() |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 268 | .setLabel("Manage types") |
| 269 | .setEmoji(getEmojiByName("TICKETS.OTHER", "id")) |
TheCodedProf | 21c0859 | 2022-09-13 14:14:43 -0400 | [diff] [blame] | 270 | .setStyle(ButtonStyle.Secondary) |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 271 | .setCustomId("manageTypes"), |
TheCodedProf | 21c0859 | 2022-09-13 14:14:43 -0400 | [diff] [blame] | 272 | new ButtonBuilder() |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 273 | .setLabel("Add create ticket button") |
| 274 | .setEmoji(getEmojiByName("TICKETS.SUGGESTION", "id")) |
TheCodedProf | 21c0859 | 2022-09-13 14:14:43 -0400 | [diff] [blame] | 275 | .setStyle(ButtonStyle.Primary) |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 276 | .setCustomId("send") |
| 277 | ]) |
| 278 | ] |
| 279 | })) as Message; |
Skyler Grey | 1a67e18 | 2022-08-04 23:05:44 +0100 | [diff] [blame] | 280 | let i: MessageComponentInteraction; |
pineafan | 6702cef | 2022-06-13 17:52:37 +0100 | [diff] [blame] | 281 | try { |
PineaFan | 0d06edc | 2023-01-17 22:10:31 +0000 | [diff] [blame] | 282 | i = await m.awaitMessageComponent({ |
| 283 | time: 300000, |
| 284 | filter: (i) => { return i.user.id === interaction.user.id && i.channel!.id === interaction.channel!.id } |
| 285 | }); |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 286 | } catch (e) { |
Skyler Grey | ad00217 | 2022-08-16 18:48:26 +0100 | [diff] [blame] | 287 | timedOut = true; |
| 288 | continue; |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 289 | } |
pineafan | 63fc5e2 | 2022-08-04 22:04:10 +0100 | [diff] [blame] | 290 | i.deferUpdate(); |
TheCodedProf | 59772f8 | 2023-01-18 22:17:16 -0500 | [diff] [blame] | 291 | if ((i.component as ButtonComponent).customId === "clearCategory") { |
pineafan | e23c4ec | 2022-07-27 21:56:27 +0100 | [diff] [blame] | 292 | if (lastClicked === "cat") { |
pineafan | 6702cef | 2022-06-13 17:52:37 +0100 | [diff] [blame] | 293 | lastClicked = ""; |
PineaFan | a00db1b | 2023-01-02 15:32:54 +0000 | [diff] [blame] | 294 | await client.database.guilds.write(interaction.guild.id, null, ["tickets.category"]); |
TheCodedProf | 59772f8 | 2023-01-18 22:17:16 -0500 | [diff] [blame] | 295 | compiledData.category = null; |
pineafan | 6702cef | 2022-06-13 17:52:37 +0100 | [diff] [blame] | 296 | } else lastClicked = "cat"; |
TheCodedProf | 59772f8 | 2023-01-18 22:17:16 -0500 | [diff] [blame] | 297 | } else if ((i.component as ButtonComponent).customId === "clearMaxTickets") { |
pineafan | e23c4ec | 2022-07-27 21:56:27 +0100 | [diff] [blame] | 298 | if (lastClicked === "max") { |
pineafan | 6702cef | 2022-06-13 17:52:37 +0100 | [diff] [blame] | 299 | lastClicked = ""; |
PineaFan | a00db1b | 2023-01-02 15:32:54 +0000 | [diff] [blame] | 300 | await client.database.guilds.write(interaction.guild.id, null, ["tickets.maxTickets"]); |
TheCodedProf | 59772f8 | 2023-01-18 22:17:16 -0500 | [diff] [blame] | 301 | compiledData.maxTickets = 5; |
pineafan | 6702cef | 2022-06-13 17:52:37 +0100 | [diff] [blame] | 302 | } else lastClicked = "max"; |
TheCodedProf | 59772f8 | 2023-01-18 22:17:16 -0500 | [diff] [blame] | 303 | } else if ((i.component as ButtonComponent).customId === "clearSupportPing") { |
pineafan | e23c4ec | 2022-07-27 21:56:27 +0100 | [diff] [blame] | 304 | if (lastClicked === "sup") { |
pineafan | 6702cef | 2022-06-13 17:52:37 +0100 | [diff] [blame] | 305 | lastClicked = ""; |
PineaFan | a00db1b | 2023-01-02 15:32:54 +0000 | [diff] [blame] | 306 | await client.database.guilds.write(interaction.guild.id, null, ["tickets.supportRole"]); |
TheCodedProf | 59772f8 | 2023-01-18 22:17:16 -0500 | [diff] [blame] | 307 | compiledData.supportRole = null; |
pineafan | 6702cef | 2022-06-13 17:52:37 +0100 | [diff] [blame] | 308 | } else lastClicked = "sup"; |
TheCodedProf | 59772f8 | 2023-01-18 22:17:16 -0500 | [diff] [blame] | 309 | } else if ((i.component as ButtonComponent).customId === "send") { |
pineafan | 41d9356 | 2022-07-30 22:10:15 +0100 | [diff] [blame] | 310 | const ticketMessages = [ |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 311 | { |
| 312 | label: "Create ticket", |
| 313 | description: "Click the button below to create a ticket" |
| 314 | }, |
| 315 | { |
| 316 | label: "Issues, questions or feedback?", |
Skyler Grey | 11236ba | 2022-08-08 21:13:33 +0100 | [diff] [blame] | 317 | description: "Click below to open a ticket and get help from our staff team" |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 318 | }, |
| 319 | { |
| 320 | label: "Contact Us", |
Skyler Grey | 11236ba | 2022-08-08 21:13:33 +0100 | [diff] [blame] | 321 | description: "Click the button below to speak to us privately" |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 322 | } |
pineafan | 63fc5e2 | 2022-08-04 22:04:10 +0100 | [diff] [blame] | 323 | ]; |
Skyler Grey | ad00217 | 2022-08-16 18:48:26 +0100 | [diff] [blame] | 324 | let innerTimedOut = false; |
| 325 | let templateSelected = false; |
| 326 | while (!innerTimedOut && !templateSelected) { |
TheCodedProf | 59772f8 | 2023-01-18 22:17:16 -0500 | [diff] [blame] | 327 | const enabled = compiledData.enabled && compiledData.category !== null; |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 328 | await interaction.editReply({ |
| 329 | embeds: [ |
| 330 | new EmojiEmbed() |
| 331 | .setTitle("Ticket Button") |
Skyler Grey | 11236ba | 2022-08-08 21:13:33 +0100 | [diff] [blame] | 332 | .setDescription("Select a message template to send in this channel") |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 333 | .setFooter({ |
| 334 | text: enabled |
| 335 | ? "" |
| 336 | : "Tickets are not set up correctly so the button may not work for users. Check the main menu to find which options must be set." |
| 337 | }) |
| 338 | .setStatus(enabled ? "Success" : "Warning") |
| 339 | .setEmoji("GUILD.ROLES.CREATE") |
| 340 | ], |
| 341 | components: [ |
TheCodedProf | 59772f8 | 2023-01-18 22:17:16 -0500 | [diff] [blame] | 342 | new ActionRowBuilder<StringSelectMenuBuilder>().addComponents([ |
TheCodedProf | a16d167 | 2023-01-18 18:58:34 -0500 | [diff] [blame] | 343 | new StringSelectMenuBuilder() |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 344 | .setOptions( |
| 345 | ticketMessages.map( |
| 346 | ( |
| 347 | t: { |
| 348 | label: string; |
| 349 | description: string; |
| 350 | value?: string; |
| 351 | }, |
| 352 | index |
| 353 | ) => { |
| 354 | t.value = index.toString(); |
| 355 | return t as { |
| 356 | value: string; |
| 357 | label: string; |
| 358 | description: string; |
| 359 | }; |
| 360 | } |
| 361 | ) |
| 362 | ) |
| 363 | .setCustomId("template") |
| 364 | .setMaxValues(1) |
| 365 | .setMinValues(1) |
| 366 | .setPlaceholder("Select a message template") |
| 367 | ]), |
TheCodedProf | 59772f8 | 2023-01-18 22:17:16 -0500 | [diff] [blame] | 368 | new ActionRowBuilder<ButtonBuilder>().addComponents([ |
TheCodedProf | 21c0859 | 2022-09-13 14:14:43 -0400 | [diff] [blame] | 369 | new ButtonBuilder() |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 370 | .setCustomId("back") |
| 371 | .setLabel("Back") |
| 372 | .setEmoji(getEmojiByName("CONTROL.LEFT", "id")) |
TheCodedProf | 21c0859 | 2022-09-13 14:14:43 -0400 | [diff] [blame] | 373 | .setStyle(ButtonStyle.Danger), |
| 374 | new ButtonBuilder().setCustomId("blank").setLabel("Empty").setStyle(ButtonStyle.Secondary), |
| 375 | new ButtonBuilder() |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 376 | .setCustomId("custom") |
| 377 | .setLabel("Custom") |
| 378 | .setEmoji(getEmojiByName("TICKETS.OTHER", "id")) |
TheCodedProf | 21c0859 | 2022-09-13 14:14:43 -0400 | [diff] [blame] | 379 | .setStyle(ButtonStyle.Primary) |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 380 | ]) |
| 381 | ] |
| 382 | }); |
Skyler Grey | 1a67e18 | 2022-08-04 23:05:44 +0100 | [diff] [blame] | 383 | let i: MessageComponentInteraction; |
pineafan | 41d9356 | 2022-07-30 22:10:15 +0100 | [diff] [blame] | 384 | try { |
PineaFan | 0d06edc | 2023-01-17 22:10:31 +0000 | [diff] [blame] | 385 | i = await m.awaitMessageComponent({ |
| 386 | time: 300000, |
| 387 | filter: (i) => { return i.user.id === interaction.user.id && i.channel!.id === interaction.channel!.id } |
| 388 | }); |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 389 | } catch (e) { |
Skyler Grey | ad00217 | 2022-08-16 18:48:26 +0100 | [diff] [blame] | 390 | innerTimedOut = true; |
| 391 | continue; |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 392 | } |
TheCodedProf | 59772f8 | 2023-01-18 22:17:16 -0500 | [diff] [blame] | 393 | if ((i.component as StringSelectMenuComponent).customId === "template") { |
pineafan | 63fc5e2 | 2022-08-04 22:04:10 +0100 | [diff] [blame] | 394 | i.deferUpdate(); |
pineafan | 3a02ea3 | 2022-08-11 21:35:04 +0100 | [diff] [blame] | 395 | await interaction.channel!.send({ |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 396 | embeds: [ |
| 397 | new EmojiEmbed() |
TheCodedProf | a16d167 | 2023-01-18 18:58:34 -0500 | [diff] [blame] | 398 | .setTitle(ticketMessages[parseInt((i as StringSelectMenuInteraction).values[0]!)]!.label) |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 399 | .setDescription( |
TheCodedProf | a16d167 | 2023-01-18 18:58:34 -0500 | [diff] [blame] | 400 | ticketMessages[parseInt((i as StringSelectMenuInteraction).values[0]!)]!.description |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 401 | ) |
| 402 | .setStatus("Success") |
| 403 | .setEmoji("GUILD.TICKET.OPEN") |
| 404 | ], |
| 405 | components: [ |
TheCodedProf | 59772f8 | 2023-01-18 22:17:16 -0500 | [diff] [blame] | 406 | new ActionRowBuilder<ButtonBuilder>().addComponents([ |
TheCodedProf | 21c0859 | 2022-09-13 14:14:43 -0400 | [diff] [blame] | 407 | new ButtonBuilder() |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 408 | .setLabel("Create Ticket") |
Skyler Grey | 11236ba | 2022-08-08 21:13:33 +0100 | [diff] [blame] | 409 | .setEmoji(getEmojiByName("CONTROL.TICK", "id")) |
TheCodedProf | 21c0859 | 2022-09-13 14:14:43 -0400 | [diff] [blame] | 410 | .setStyle(ButtonStyle.Success) |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 411 | .setCustomId("createticket") |
| 412 | ]) |
| 413 | ] |
| 414 | }); |
Skyler Grey | ad00217 | 2022-08-16 18:48:26 +0100 | [diff] [blame] | 415 | templateSelected = true; |
| 416 | continue; |
TheCodedProf | 59772f8 | 2023-01-18 22:17:16 -0500 | [diff] [blame] | 417 | } else if ((i.component as ButtonComponent).customId === "blank") { |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 418 | i.deferUpdate(); |
pineafan | 3a02ea3 | 2022-08-11 21:35:04 +0100 | [diff] [blame] | 419 | await interaction.channel!.send({ |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 420 | components: [ |
TheCodedProf | 59772f8 | 2023-01-18 22:17:16 -0500 | [diff] [blame] | 421 | new ActionRowBuilder<ButtonBuilder>().addComponents([ |
TheCodedProf | 21c0859 | 2022-09-13 14:14:43 -0400 | [diff] [blame] | 422 | new ButtonBuilder() |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 423 | .setLabel("Create Ticket") |
Skyler Grey | 11236ba | 2022-08-08 21:13:33 +0100 | [diff] [blame] | 424 | .setEmoji(getEmojiByName("TICKETS.SUGGESTION", "id")) |
TheCodedProf | 21c0859 | 2022-09-13 14:14:43 -0400 | [diff] [blame] | 425 | .setStyle(ButtonStyle.Success) |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 426 | .setCustomId("createticket") |
| 427 | ]) |
| 428 | ] |
| 429 | }); |
Skyler Grey | ad00217 | 2022-08-16 18:48:26 +0100 | [diff] [blame] | 430 | templateSelected = true; |
| 431 | continue; |
TheCodedProf | 59772f8 | 2023-01-18 22:17:16 -0500 | [diff] [blame] | 432 | } else if ((i.component as ButtonComponent).customId === "custom") { |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 433 | await i.showModal( |
TheCodedProf | 59772f8 | 2023-01-18 22:17:16 -0500 | [diff] [blame] | 434 | new Discord.ModalBuilder() |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 435 | .setCustomId("modal") |
| 436 | .setTitle("Enter embed details") |
| 437 | .addComponents( |
TheCodedProf | 59772f8 | 2023-01-18 22:17:16 -0500 | [diff] [blame] | 438 | new ActionRowBuilder<TextInputBuilder>().addComponents( |
| 439 | new TextInputBuilder() |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 440 | .setCustomId("title") |
| 441 | .setLabel("Title") |
| 442 | .setMaxLength(256) |
| 443 | .setRequired(true) |
TheCodedProf | 59772f8 | 2023-01-18 22:17:16 -0500 | [diff] [blame] | 444 | .setStyle(Discord.TextInputStyle.Short) |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 445 | ), |
TheCodedProf | 59772f8 | 2023-01-18 22:17:16 -0500 | [diff] [blame] | 446 | new ActionRowBuilder<TextInputBuilder>().addComponents( |
| 447 | new TextInputBuilder() |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 448 | .setCustomId("description") |
| 449 | .setLabel("Description") |
| 450 | .setMaxLength(4000) |
| 451 | .setRequired(true) |
TheCodedProf | 59772f8 | 2023-01-18 22:17:16 -0500 | [diff] [blame] | 452 | .setStyle(Discord.TextInputStyle.Paragraph) |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 453 | ) |
| 454 | ) |
| 455 | ); |
pineafan | 41d9356 | 2022-07-30 22:10:15 +0100 | [diff] [blame] | 456 | await interaction.editReply({ |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 457 | embeds: [ |
| 458 | new EmojiEmbed() |
| 459 | .setTitle("Ticket Button") |
Skyler Grey | 11236ba | 2022-08-08 21:13:33 +0100 | [diff] [blame] | 460 | .setDescription("Modal opened. If you can't see it, click back and try again.") |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 461 | .setStatus("Success") |
| 462 | .setEmoji("GUILD.TICKET.OPEN") |
| 463 | ], |
| 464 | components: [ |
TheCodedProf | 59772f8 | 2023-01-18 22:17:16 -0500 | [diff] [blame] | 465 | new ActionRowBuilder<ButtonBuilder>().addComponents([ |
TheCodedProf | 21c0859 | 2022-09-13 14:14:43 -0400 | [diff] [blame] | 466 | new ButtonBuilder() |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 467 | .setLabel("Back") |
Skyler Grey | 11236ba | 2022-08-08 21:13:33 +0100 | [diff] [blame] | 468 | .setEmoji(getEmojiByName("CONTROL.LEFT", "id")) |
TheCodedProf | 21c0859 | 2022-09-13 14:14:43 -0400 | [diff] [blame] | 469 | .setStyle(ButtonStyle.Primary) |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 470 | .setCustomId("back") |
| 471 | ]) |
| 472 | ] |
pineafan | 41d9356 | 2022-07-30 22:10:15 +0100 | [diff] [blame] | 473 | }); |
| 474 | let out; |
| 475 | try { |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 476 | out = await modalInteractionCollector( |
| 477 | m, |
pineafan | 3a02ea3 | 2022-08-11 21:35:04 +0100 | [diff] [blame] | 478 | (m) => m.channel!.id === interaction.channel!.id, |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 479 | (m) => m.customId === "modify" |
| 480 | ); |
| 481 | } catch (e) { |
Skyler Grey | ad00217 | 2022-08-16 18:48:26 +0100 | [diff] [blame] | 482 | innerTimedOut = true; |
| 483 | continue; |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 484 | } |
TheCodedProf | 59772f8 | 2023-01-18 22:17:16 -0500 | [diff] [blame] | 485 | out = out as ModalSubmitInteraction; |
PineaFan | 638eb13 | 2023-01-19 10:41:22 +0000 | [diff] [blame] | 486 | const title = out.fields.getTextInputValue("title"); |
| 487 | const description = out.fields.getTextInputValue("description"); |
| 488 | await interaction.channel!.send({ |
| 489 | embeds: [ |
| 490 | new EmojiEmbed() |
| 491 | .setTitle(title) |
| 492 | .setDescription(description) |
| 493 | .setStatus("Success") |
| 494 | .setEmoji("GUILD.TICKET.OPEN") |
| 495 | ], |
| 496 | components: [ |
| 497 | new ActionRowBuilder<ButtonBuilder>().addComponents([ |
| 498 | new ButtonBuilder() |
| 499 | .setLabel("Create Ticket") |
| 500 | .setEmoji(getEmojiByName("TICKETS.SUGGESTION", "id")) |
| 501 | .setStyle(ButtonStyle.Success) |
| 502 | .setCustomId("createticket") |
| 503 | ]) |
| 504 | ] |
| 505 | }); |
| 506 | templateSelected = true; |
pineafan | 41d9356 | 2022-07-30 22:10:15 +0100 | [diff] [blame] | 507 | } |
| 508 | } |
TheCodedProf | 59772f8 | 2023-01-18 22:17:16 -0500 | [diff] [blame] | 509 | } else if ((i.component as ButtonComponent).customId === "enabled") { |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 510 | await client.database.guilds.write(interaction.guild.id, { |
TheCodedProf | 59772f8 | 2023-01-18 22:17:16 -0500 | [diff] [blame] | 511 | "tickets.enabled": !compiledData.enabled |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 512 | }); |
TheCodedProf | 59772f8 | 2023-01-18 22:17:16 -0500 | [diff] [blame] | 513 | compiledData.enabled = !compiledData.enabled; |
| 514 | } else if ((i.component as ButtonComponent).customId === "manageTypes") { |
PineaFan | 638eb13 | 2023-01-19 10:41:22 +0000 | [diff] [blame] | 515 | data.tickets = await manageTypes(interaction, data.tickets, m as Message); |
pineafan | 6702cef | 2022-06-13 17:52:37 +0100 | [diff] [blame] | 516 | } |
| 517 | } |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 518 | await interaction.editReply({ |
TheCodedProf | 59772f8 | 2023-01-18 22:17:16 -0500 | [diff] [blame] | 519 | embeds: [ embed.setFooter({ text: "Message timed out" })], |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 520 | components: [] |
| 521 | }); |
pineafan | 63fc5e2 | 2022-08-04 22:04:10 +0100 | [diff] [blame] | 522 | }; |
pineafan | 4f164f3 | 2022-02-26 22:07:12 +0000 | [diff] [blame] | 523 | |
Skyler Grey | 11236ba | 2022-08-08 21:13:33 +0100 | [diff] [blame] | 524 | async function manageTypes(interaction: CommandInteraction, data: GuildConfig["tickets"], m: Message) { |
Skyler Grey | ad00217 | 2022-08-16 18:48:26 +0100 | [diff] [blame] | 525 | let timedOut = false; |
| 526 | let backPressed = false; |
| 527 | while (!timedOut && !backPressed) { |
pineafan | 6702cef | 2022-06-13 17:52:37 +0100 | [diff] [blame] | 528 | if (data.useCustom) { |
pineafan | 63fc5e2 | 2022-08-04 22:04:10 +0100 | [diff] [blame] | 529 | const customTypes = data.customTypes; |
pineafan | c6158ab | 2022-06-17 16:34:07 +0100 | [diff] [blame] | 530 | await interaction.editReply({ |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 531 | embeds: [ |
| 532 | new EmojiEmbed() |
| 533 | .setTitle("Tickets > Types") |
| 534 | .setDescription( |
| 535 | "**Custom types enabled**\n\n" + |
| 536 | "**Types in use:**\n" + |
Skyler Grey | 11236ba | 2022-08-08 21:13:33 +0100 | [diff] [blame] | 537 | (customTypes !== null ? customTypes.map((t) => `> ${t}`).join("\n") : "*None set*") + |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 538 | "\n\n" + |
| 539 | (customTypes === null |
| 540 | ? `${getEmojiByName( |
| 541 | "TICKETS.REPORT" |
| 542 | )} Having no types will disable tickets. Please add at least 1 type or use default types` |
| 543 | : "") |
pineafan | 6702cef | 2022-06-13 17:52:37 +0100 | [diff] [blame] | 544 | ) |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 545 | .setStatus("Success") |
| 546 | .setEmoji("GUILD.TICKET.OPEN") |
| 547 | ], |
| 548 | components: (customTypes |
| 549 | ? [ |
TheCodedProf | 59772f8 | 2023-01-18 22:17:16 -0500 | [diff] [blame] | 550 | new ActionRowBuilder<StringSelectMenuBuilder | ButtonBuilder>().addComponents([ |
TheCodedProf | a16d167 | 2023-01-18 18:58:34 -0500 | [diff] [blame] | 551 | new Discord.StringSelectMenuBuilder() |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 552 | .setCustomId("removeTypes") |
| 553 | .setPlaceholder("Select types to remove") |
| 554 | .setMaxValues(customTypes.length) |
| 555 | .setMinValues(1) |
| 556 | .addOptions( |
| 557 | customTypes.map((t) => ({ |
| 558 | label: t, |
| 559 | value: t |
| 560 | })) |
| 561 | ) |
| 562 | ]) |
| 563 | ] |
| 564 | : [] |
| 565 | ).concat([ |
TheCodedProf | 59772f8 | 2023-01-18 22:17:16 -0500 | [diff] [blame] | 566 | new ActionRowBuilder<ButtonBuilder>().addComponents([ |
TheCodedProf | 21c0859 | 2022-09-13 14:14:43 -0400 | [diff] [blame] | 567 | new ButtonBuilder() |
pineafan | 6702cef | 2022-06-13 17:52:37 +0100 | [diff] [blame] | 568 | .setLabel("Back") |
| 569 | .setEmoji(getEmojiByName("CONTROL.LEFT", "id")) |
TheCodedProf | 21c0859 | 2022-09-13 14:14:43 -0400 | [diff] [blame] | 570 | .setStyle(ButtonStyle.Primary) |
pineafan | 6702cef | 2022-06-13 17:52:37 +0100 | [diff] [blame] | 571 | .setCustomId("back"), |
TheCodedProf | 21c0859 | 2022-09-13 14:14:43 -0400 | [diff] [blame] | 572 | new ButtonBuilder() |
pineafan | 6702cef | 2022-06-13 17:52:37 +0100 | [diff] [blame] | 573 | .setLabel("Add new type") |
Skyler Grey | 11236ba | 2022-08-08 21:13:33 +0100 | [diff] [blame] | 574 | .setEmoji(getEmojiByName("TICKETS.SUGGESTION", "id")) |
TheCodedProf | 21c0859 | 2022-09-13 14:14:43 -0400 | [diff] [blame] | 575 | .setStyle(ButtonStyle.Primary) |
pineafan | 6702cef | 2022-06-13 17:52:37 +0100 | [diff] [blame] | 576 | .setCustomId("addType") |
Skyler Grey | 11236ba | 2022-08-08 21:13:33 +0100 | [diff] [blame] | 577 | .setDisabled(customTypes !== null && customTypes.length >= 25), |
TheCodedProf | 21c0859 | 2022-09-13 14:14:43 -0400 | [diff] [blame] | 578 | new ButtonBuilder() |
pineafan | 6702cef | 2022-06-13 17:52:37 +0100 | [diff] [blame] | 579 | .setLabel("Switch to default types") |
TheCodedProf | 21c0859 | 2022-09-13 14:14:43 -0400 | [diff] [blame] | 580 | .setStyle(ButtonStyle.Secondary) |
pineafan | 63fc5e2 | 2022-08-04 22:04:10 +0100 | [diff] [blame] | 581 | .setCustomId("switchToDefault") |
pineafan | 6702cef | 2022-06-13 17:52:37 +0100 | [diff] [blame] | 582 | ]) |
| 583 | ]) |
| 584 | }); |
| 585 | } else { |
pineafan | 63fc5e2 | 2022-08-04 22:04:10 +0100 | [diff] [blame] | 586 | const inUse = toHexArray(data.types, ticketTypes); |
TheCodedProf | 59772f8 | 2023-01-18 22:17:16 -0500 | [diff] [blame] | 587 | const options: StringSelectMenuOptionBuilder[] = []; |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 588 | ticketTypes.forEach((type) => { |
| 589 | options.push( |
TheCodedProf | 59772f8 | 2023-01-18 22:17:16 -0500 | [diff] [blame] | 590 | new StringSelectMenuOptionBuilder({ |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 591 | label: capitalize(type), |
| 592 | value: type, |
TheCodedProf | 59772f8 | 2023-01-18 22:17:16 -0500 | [diff] [blame] | 593 | emoji: client.emojis.cache.get(getEmojiByName(`TICKETS.${type.toUpperCase()}`, "id")) as APIMessageComponentEmoji, |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 594 | default: inUse.includes(type) |
| 595 | }) |
| 596 | ); |
pineafan | 63fc5e2 | 2022-08-04 22:04:10 +0100 | [diff] [blame] | 597 | }); |
TheCodedProf | 59772f8 | 2023-01-18 22:17:16 -0500 | [diff] [blame] | 598 | const selectPane = new ActionRowBuilder<StringSelectMenuBuilder>().addComponents([ |
TheCodedProf | a16d167 | 2023-01-18 18:58:34 -0500 | [diff] [blame] | 599 | new Discord.StringSelectMenuBuilder() |
pineafan | 6702cef | 2022-06-13 17:52:37 +0100 | [diff] [blame] | 600 | .addOptions(options) |
| 601 | .setCustomId("types") |
| 602 | .setMaxValues(ticketTypes.length) |
| 603 | .setMinValues(1) |
| 604 | .setPlaceholder("Select types to use") |
pineafan | 63fc5e2 | 2022-08-04 22:04:10 +0100 | [diff] [blame] | 605 | ]); |
pineafan | c6158ab | 2022-06-17 16:34:07 +0100 | [diff] [blame] | 606 | await interaction.editReply({ |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 607 | embeds: [ |
| 608 | new EmojiEmbed() |
| 609 | .setTitle("Tickets > Types") |
| 610 | .setDescription( |
| 611 | "**Default types enabled**\n\n" + |
| 612 | "**Types in use:**\n" + |
| 613 | inUse |
Skyler Grey | 11236ba | 2022-08-08 21:13:33 +0100 | [diff] [blame] | 614 | .map((t) => `> ${getEmojiByName("TICKETS." + t.toUpperCase())} ${capitalize(t)}`) |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 615 | .join("\n") |
| 616 | ) |
| 617 | .setStatus("Success") |
| 618 | .setEmoji("GUILD.TICKET.OPEN") |
| 619 | ], |
| 620 | components: [ |
pineafan | 6702cef | 2022-06-13 17:52:37 +0100 | [diff] [blame] | 621 | selectPane, |
TheCodedProf | 59772f8 | 2023-01-18 22:17:16 -0500 | [diff] [blame] | 622 | new ActionRowBuilder<ButtonBuilder>().addComponents([ |
TheCodedProf | 21c0859 | 2022-09-13 14:14:43 -0400 | [diff] [blame] | 623 | new ButtonBuilder() |
pineafan | 6702cef | 2022-06-13 17:52:37 +0100 | [diff] [blame] | 624 | .setLabel("Back") |
| 625 | .setEmoji(getEmojiByName("CONTROL.LEFT", "id")) |
TheCodedProf | 21c0859 | 2022-09-13 14:14:43 -0400 | [diff] [blame] | 626 | .setStyle(ButtonStyle.Primary) |
pineafan | 6702cef | 2022-06-13 17:52:37 +0100 | [diff] [blame] | 627 | .setCustomId("back"), |
TheCodedProf | 21c0859 | 2022-09-13 14:14:43 -0400 | [diff] [blame] | 628 | new ButtonBuilder() |
pineafan | 6702cef | 2022-06-13 17:52:37 +0100 | [diff] [blame] | 629 | .setLabel("Switch to custom types") |
TheCodedProf | 21c0859 | 2022-09-13 14:14:43 -0400 | [diff] [blame] | 630 | .setStyle(ButtonStyle.Secondary) |
pineafan | 63fc5e2 | 2022-08-04 22:04:10 +0100 | [diff] [blame] | 631 | .setCustomId("switchToCustom") |
pineafan | 6702cef | 2022-06-13 17:52:37 +0100 | [diff] [blame] | 632 | ]) |
| 633 | ] |
| 634 | }); |
| 635 | } |
| 636 | let i; |
| 637 | try { |
PineaFan | 0d06edc | 2023-01-17 22:10:31 +0000 | [diff] [blame] | 638 | i = await m.awaitMessageComponent({ |
| 639 | time: 300000, |
| 640 | filter: (i) => { return i.user.id === interaction.user.id && i.channel!.id === interaction.channel!.id } |
| 641 | }); |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 642 | } catch (e) { |
Skyler Grey | ad00217 | 2022-08-16 18:48:26 +0100 | [diff] [blame] | 643 | timedOut = true; |
| 644 | continue; |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 645 | } |
TheCodedProf | 59772f8 | 2023-01-18 22:17:16 -0500 | [diff] [blame] | 646 | if ((i.component as StringSelectMenuComponent).customId === "types") { |
pineafan | 63fc5e2 | 2022-08-04 22:04:10 +0100 | [diff] [blame] | 647 | i.deferUpdate(); |
TheCodedProf | 59772f8 | 2023-01-18 22:17:16 -0500 | [diff] [blame] | 648 | const types = toHexInteger((i as StringSelectMenuInteraction).values, ticketTypes); |
| 649 | await client.database.guilds.write(interaction.guild!.id, { |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 650 | "tickets.types": types |
| 651 | }); |
pineafan | 6702cef | 2022-06-13 17:52:37 +0100 | [diff] [blame] | 652 | data.types = types; |
TheCodedProf | 59772f8 | 2023-01-18 22:17:16 -0500 | [diff] [blame] | 653 | } else if ((i.component as StringSelectMenuComponent).customId === "removeTypes") { |
pineafan | 63fc5e2 | 2022-08-04 22:04:10 +0100 | [diff] [blame] | 654 | i.deferUpdate(); |
TheCodedProf | 59772f8 | 2023-01-18 22:17:16 -0500 | [diff] [blame] | 655 | const types = (i as StringSelectMenuInteraction).values; |
pineafan | 6702cef | 2022-06-13 17:52:37 +0100 | [diff] [blame] | 656 | let customTypes = data.customTypes; |
| 657 | if (customTypes) { |
| 658 | customTypes = customTypes.filter((t) => !types.includes(t)); |
| 659 | customTypes = customTypes.length > 0 ? customTypes : null; |
TheCodedProf | 59772f8 | 2023-01-18 22:17:16 -0500 | [diff] [blame] | 660 | await client.database.guilds.write(interaction.guild!.id, { |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 661 | "tickets.customTypes": customTypes |
| 662 | }); |
pineafan | 6702cef | 2022-06-13 17:52:37 +0100 | [diff] [blame] | 663 | data.customTypes = customTypes; |
| 664 | } |
TheCodedProf | 59772f8 | 2023-01-18 22:17:16 -0500 | [diff] [blame] | 665 | } else if ((i.component as ButtonComponent).customId === "addType") { |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 666 | await i.showModal( |
TheCodedProf | 59772f8 | 2023-01-18 22:17:16 -0500 | [diff] [blame] | 667 | new Discord.ModalBuilder() |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 668 | .setCustomId("modal") |
| 669 | .setTitle("Enter a name for the new type") |
| 670 | .addComponents( |
TheCodedProf | 59772f8 | 2023-01-18 22:17:16 -0500 | [diff] [blame] | 671 | new ActionRowBuilder<TextInputBuilder>().addComponents( |
| 672 | new TextInputBuilder() |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 673 | .setCustomId("type") |
| 674 | .setLabel("Name") |
| 675 | .setMaxLength(100) |
| 676 | .setMinLength(1) |
| 677 | .setPlaceholder('E.g. "Server Idea"') |
| 678 | .setRequired(true) |
TheCodedProf | 59772f8 | 2023-01-18 22:17:16 -0500 | [diff] [blame] | 679 | .setStyle(Discord.TextInputStyle.Short) |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 680 | ) |
| 681 | ) |
| 682 | ); |
pineafan | 6702cef | 2022-06-13 17:52:37 +0100 | [diff] [blame] | 683 | await interaction.editReply({ |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 684 | embeds: [ |
| 685 | new EmojiEmbed() |
| 686 | .setTitle("Tickets > Types") |
Skyler Grey | 11236ba | 2022-08-08 21:13:33 +0100 | [diff] [blame] | 687 | .setDescription("Modal opened. If you can't see it, click back and try again.") |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 688 | .setStatus("Success") |
| 689 | .setEmoji("GUILD.TICKET.OPEN") |
| 690 | ], |
| 691 | components: [ |
TheCodedProf | 59772f8 | 2023-01-18 22:17:16 -0500 | [diff] [blame] | 692 | new ActionRowBuilder<ButtonBuilder>().addComponents([ |
TheCodedProf | 21c0859 | 2022-09-13 14:14:43 -0400 | [diff] [blame] | 693 | new ButtonBuilder() |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 694 | .setLabel("Back") |
| 695 | .setEmoji(getEmojiByName("CONTROL.LEFT", "id")) |
TheCodedProf | 21c0859 | 2022-09-13 14:14:43 -0400 | [diff] [blame] | 696 | .setStyle(ButtonStyle.Primary) |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 697 | .setCustomId("back") |
| 698 | ]) |
| 699 | ] |
pineafan | 6702cef | 2022-06-13 17:52:37 +0100 | [diff] [blame] | 700 | }); |
pineafan | 4edb776 | 2022-06-26 19:21:04 +0100 | [diff] [blame] | 701 | let out; |
pineafan | 6702cef | 2022-06-13 17:52:37 +0100 | [diff] [blame] | 702 | try { |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 703 | out = await modalInteractionCollector( |
| 704 | m, |
TheCodedProf | 59772f8 | 2023-01-18 22:17:16 -0500 | [diff] [blame] | 705 | (m) => m.channel!.id === interaction.channel!.id, |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 706 | (m) => m.customId === "addType" |
| 707 | ); |
| 708 | } catch (e) { |
| 709 | continue; |
| 710 | } |
TheCodedProf | 59772f8 | 2023-01-18 22:17:16 -0500 | [diff] [blame] | 711 | out = out as ModalSubmitInteraction; |
PineaFan | 638eb13 | 2023-01-19 10:41:22 +0000 | [diff] [blame] | 712 | let toAdd = out.fields.getTextInputValue("type"); |
| 713 | if (!toAdd) { |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 714 | continue; |
| 715 | } |
PineaFan | 638eb13 | 2023-01-19 10:41:22 +0000 | [diff] [blame] | 716 | toAdd = toAdd.substring(0, 80); |
| 717 | try { |
| 718 | await client.database.guilds.append(interaction.guild!.id, "tickets.customTypes", toAdd); |
| 719 | } catch { |
| 720 | continue; |
| 721 | } |
| 722 | data.customTypes = data.customTypes ?? []; |
| 723 | if (!data.customTypes.includes(toAdd)) { |
| 724 | data.customTypes.push(toAdd); |
| 725 | } |
TheCodedProf | 59772f8 | 2023-01-18 22:17:16 -0500 | [diff] [blame] | 726 | } else if ((i.component as ButtonComponent).customId === "switchToDefault") { |
pineafan | 63fc5e2 | 2022-08-04 22:04:10 +0100 | [diff] [blame] | 727 | i.deferUpdate(); |
TheCodedProf | 59772f8 | 2023-01-18 22:17:16 -0500 | [diff] [blame] | 728 | await client.database.guilds.write(interaction.guild!.id, { "tickets.useCustom": false }, []); |
pineafan | 6702cef | 2022-06-13 17:52:37 +0100 | [diff] [blame] | 729 | data.useCustom = false; |
TheCodedProf | 59772f8 | 2023-01-18 22:17:16 -0500 | [diff] [blame] | 730 | } else if ((i.component as ButtonComponent).customId === "switchToCustom") { |
pineafan | 63fc5e2 | 2022-08-04 22:04:10 +0100 | [diff] [blame] | 731 | i.deferUpdate(); |
TheCodedProf | 59772f8 | 2023-01-18 22:17:16 -0500 | [diff] [blame] | 732 | await client.database.guilds.write(interaction.guild!.id, { "tickets.useCustom": true }, []); |
pineafan | 6702cef | 2022-06-13 17:52:37 +0100 | [diff] [blame] | 733 | data.useCustom = true; |
| 734 | } else { |
pineafan | 63fc5e2 | 2022-08-04 22:04:10 +0100 | [diff] [blame] | 735 | i.deferUpdate(); |
Skyler Grey | ad00217 | 2022-08-16 18:48:26 +0100 | [diff] [blame] | 736 | backPressed = true; |
pineafan | 6702cef | 2022-06-13 17:52:37 +0100 | [diff] [blame] | 737 | } |
| 738 | } |
pineafan | 63fc5e2 | 2022-08-04 22:04:10 +0100 | [diff] [blame] | 739 | return data; |
pineafan | 6702cef | 2022-06-13 17:52:37 +0100 | [diff] [blame] | 740 | } |
| 741 | |
Skyler Grey | 1a67e18 | 2022-08-04 23:05:44 +0100 | [diff] [blame] | 742 | const check = (interaction: CommandInteraction) => { |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 743 | const member = interaction.member as Discord.GuildMember; |
PineaFan | a00db1b | 2023-01-02 15:32:54 +0000 | [diff] [blame] | 744 | if (!member.permissions.has("ManageGuild")) |
PineaFan | 0d06edc | 2023-01-17 22:10:31 +0000 | [diff] [blame] | 745 | return "You must have the *Manage Server* permission to use this command"; |
pineafan | 6702cef | 2022-06-13 17:52:37 +0100 | [diff] [blame] | 746 | return true; |
pineafan | 63fc5e2 | 2022-08-04 22:04:10 +0100 | [diff] [blame] | 747 | }; |
pineafan | 4f164f3 | 2022-02-26 22:07:12 +0000 | [diff] [blame] | 748 | |
| 749 | export { command }; |
| 750 | export { callback }; |
Skyler Grey | 1a67e18 | 2022-08-04 23:05:44 +0100 | [diff] [blame] | 751 | export { check }; |