Skyler Grey | da16adf | 2023-03-05 10:22:12 +0000 | [diff] [blame^] | 1 | import type { ButtonInteraction, ContextMenuCommandInteraction } from "discord.js"; |
| 2 | import type { CommandInteraction } from "discord.js"; |
PineaFan | 9b2ac4d | 2023-01-18 14:41:07 +0000 | [diff] [blame] | 3 | import type { NucleusClient } from "../utils/client.js"; |
pineafan | 4edb776 | 2022-06-26 19:21:04 +0100 | [diff] [blame] | 4 | import EmojiEmbed from "../utils/generateEmojiEmbed.js"; |
pineafan | 34369e6 | 2022-05-18 16:52:37 +0100 | [diff] [blame] | 5 | |
pineafan | 63fc5e2 | 2022-08-04 22:04:10 +0100 | [diff] [blame] | 6 | export const event = "commandError"; |
pineafan | 34369e6 | 2022-05-18 16:52:37 +0100 | [diff] [blame] | 7 | |
Skyler Grey | da16adf | 2023-03-05 10:22:12 +0000 | [diff] [blame^] | 8 | export async function callback( |
| 9 | _: NucleusClient, |
| 10 | interaction: CommandInteraction | ButtonInteraction | ContextMenuCommandInteraction, |
| 11 | error: string |
| 12 | ) { |
PineaFan | c4d6c3f | 2023-01-19 12:17:25 +0000 | [diff] [blame] | 13 | const embed = new EmojiEmbed() |
| 14 | .setTitle("Something went wrong") |
| 15 | .setDescription(error) |
| 16 | .setStatus("Danger") |
Skyler Grey | da16adf | 2023-03-05 10:22:12 +0000 | [diff] [blame^] | 17 | .setEmoji("CONTROL.BLOCKCROSS"); |
pineafan | 34369e6 | 2022-05-18 16:52:37 +0100 | [diff] [blame] | 18 | if (interaction.replied || interaction.deferred) { |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 19 | await interaction.followUp({ |
PineaFan | c4d6c3f | 2023-01-19 12:17:25 +0000 | [diff] [blame] | 20 | embeds: [embed], |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 21 | ephemeral: true |
| 22 | }); |
pineafan | 34369e6 | 2022-05-18 16:52:37 +0100 | [diff] [blame] | 23 | } else { |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 24 | await interaction.reply({ |
PineaFan | c4d6c3f | 2023-01-19 12:17:25 +0000 | [diff] [blame] | 25 | embeds: [embed], |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 26 | ephemeral: true |
| 27 | }); |
pineafan | 34369e6 | 2022-05-18 16:52:37 +0100 | [diff] [blame] | 28 | } |
| 29 | } |