pineafan | 63fc5e2 | 2022-08-04 22:04:10 +0100 | [diff] [blame] | 1 | import { callback as roleMenu } from "../actions/roleMenu.js"; |
pineafan | 73a7c4a | 2022-07-24 10:38:04 +0100 | [diff] [blame] | 2 | import verify from "../reflex/verify.js"; |
| 3 | import create from "../actions/tickets/create.js"; |
| 4 | import close from "../actions/tickets/delete.js"; |
| 5 | import createTranscript from "../premium/createTranscript.js"; |
PineaFan | a34d04b | 2023-01-03 22:05:42 +0000 | [diff] [blame] | 6 | |
PineaFan | 538d375 | 2023-01-12 21:48:23 +0000 | [diff] [blame^] | 7 | import type { Interaction } from "discord.js"; |
PineaFan | 752af46 | 2022-12-31 21:59:38 +0000 | [diff] [blame] | 8 | import type { NucleusClient } from "../utils/client.js"; |
pineafan | ad54d75 | 2022-04-18 19:01:43 +0100 | [diff] [blame] | 9 | |
pineafan | 63fc5e2 | 2022-08-04 22:04:10 +0100 | [diff] [blame] | 10 | export const event = "interactionCreate"; |
pineafan | ad54d75 | 2022-04-18 19:01:43 +0100 | [diff] [blame] | 11 | |
pineafan | 02ba023 | 2022-07-24 22:16:15 +0100 | [diff] [blame] | 12 | |
pineafan | 0f5cc78 | 2022-08-12 21:55:42 +0100 | [diff] [blame] | 13 | async function interactionCreate(interaction: Interaction) { |
PineaFan | a34d04b | 2023-01-03 22:05:42 +0000 | [diff] [blame] | 14 | if (interaction.isButton()) { |
PineaFan | 538d375 | 2023-01-12 21:48:23 +0000 | [diff] [blame^] | 15 | switch (interaction.customId) { |
| 16 | case "rolemenu": { return await roleMenu(interaction); } |
| 17 | case "verifybutton": { return await verify(interaction); } |
| 18 | case "createticket": { return await create(interaction); } |
| 19 | case "closeticket": { return await close(interaction); } |
| 20 | case "createtranscript": { return await createTranscript(interaction); } |
pineafan | 02ba023 | 2022-07-24 22:16:15 +0100 | [diff] [blame] | 21 | } |
PineaFan | a34d04b | 2023-01-03 22:05:42 +0000 | [diff] [blame] | 22 | // } else if (interaction.type === "APPLICATION_COMMAND_AUTOCOMPLETE") { |
| 23 | // const int = interaction as AutocompleteInteraction; |
| 24 | // switch (`${int.commandName} ${int.options.getSubcommandGroup(false)} ${int.options.getSubcommand(false)}`) { |
PineaFan | a34d04b | 2023-01-03 22:05:42 +0000 | [diff] [blame] | 25 | // case "settings null stats": { |
| 26 | // return int.respond(generateStatsChannelAutocomplete(int.options.getString("name") ?? "")); |
| 27 | // } |
| 28 | // case "settings null welcome": { |
| 29 | // return int.respond(generateWelcomeMessageAutocomplete(int.options.getString("message") ?? "")); |
| 30 | // } |
| 31 | // } |
pineafan | ad54d75 | 2022-04-18 19:01:43 +0100 | [diff] [blame] | 32 | } |
| 33 | } |
| 34 | |
PineaFan | 752af46 | 2022-12-31 21:59:38 +0000 | [diff] [blame] | 35 | export async function callback(_client: NucleusClient, interaction: Interaction) { |
pineafan | 63fc5e2 | 2022-08-04 22:04:10 +0100 | [diff] [blame] | 36 | await interactionCreate(interaction); |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 37 | } |