blob: 1796146985bcabead42962ce16bbbe5ac9bec92d [file] [log] [blame]
pineafan63fc5e22022-08-04 22:04:10 +01001import { callback as roleMenu } from "../actions/roleMenu.js";
pineafan73a7c4a2022-07-24 10:38:04 +01002import verify from "../reflex/verify.js";
3import create from "../actions/tickets/create.js";
4import close from "../actions/tickets/delete.js";
5import createTranscript from "../premium/createTranscript.js";
PineaFana34d04b2023-01-03 22:05:42 +00006
7import type { Interaction, MessageComponentInteraction } from "discord.js";
PineaFan752af462022-12-31 21:59:38 +00008import type { NucleusClient } from "../utils/client.js";
pineafanad54d752022-04-18 19:01:43 +01009
pineafan63fc5e22022-08-04 22:04:10 +010010export const event = "interactionCreate";
pineafanad54d752022-04-18 19:01:43 +010011
pineafan02ba0232022-07-24 22:16:15 +010012
pineafan0f5cc782022-08-12 21:55:42 +010013async function interactionCreate(interaction: Interaction) {
PineaFana34d04b2023-01-03 22:05:42 +000014 if (interaction.isButton()) {
Skyler Greyf21323a2022-08-13 23:58:22 +010015 const int = interaction as MessageComponentInteraction;
pineafan0f5cc782022-08-12 21:55:42 +010016 switch (int.customId) {
Skyler Grey75ea9172022-08-06 10:22:23 +010017 case "rolemenu": {
18 return await roleMenu(interaction);
19 }
20 case "verifybutton": {
pineafan0f5cc782022-08-12 21:55:42 +010021 return verify(int);
Skyler Grey75ea9172022-08-06 10:22:23 +010022 }
23 case "createticket": {
24 return create(interaction);
25 }
26 case "closeticket": {
27 return close(interaction);
28 }
29 case "createtranscript": {
pineafan0f5cc782022-08-12 21:55:42 +010030 return createTranscript(int);
Skyler Grey75ea9172022-08-06 10:22:23 +010031 }
pineafan02ba0232022-07-24 22:16:15 +010032 }
PineaFana34d04b2023-01-03 22:05:42 +000033 // } else if (interaction.type === "APPLICATION_COMMAND_AUTOCOMPLETE") {
34 // const int = interaction as AutocompleteInteraction;
35 // switch (`${int.commandName} ${int.options.getSubcommandGroup(false)} ${int.options.getSubcommand(false)}`) {
36 // case "tag null null": {
37 // return int.respond(getAutocomplete(int.options.getString("tag") ?? "", await tagAutocomplete(int)));
38 // }
39 // case "settings null stats": {
40 // return int.respond(generateStatsChannelAutocomplete(int.options.getString("name") ?? ""));
41 // }
42 // case "settings null welcome": {
43 // return int.respond(generateWelcomeMessageAutocomplete(int.options.getString("message") ?? ""));
44 // }
45 // }
pineafanad54d752022-04-18 19:01:43 +010046 }
47}
48
PineaFan752af462022-12-31 21:59:38 +000049export async function callback(_client: NucleusClient, interaction: Interaction) {
pineafan63fc5e22022-08-04 22:04:10 +010050 await interactionCreate(interaction);
Skyler Grey75ea9172022-08-06 10:22:23 +010051}