blob: ff5f4ae8c95f3b88f7c0974750bf6df2f4afda60 [file] [log] [blame]
PineaFan9b2ac4d2023-01-18 14:41:07 +00001import type { ButtonInteraction, ContextMenuCommandInteraction } from 'discord.js';
2import type { CommandInteraction } from 'discord.js';
3import type { NucleusClient } from "../utils/client.js";
pineafan4edb7762022-06-26 19:21:04 +01004import EmojiEmbed from "../utils/generateEmojiEmbed.js";
pineafan34369e62022-05-18 16:52:37 +01005
pineafan63fc5e22022-08-04 22:04:10 +01006export const event = "commandError";
pineafan34369e62022-05-18 16:52:37 +01007
PineaFan9b2ac4d2023-01-18 14:41:07 +00008export async function callback(_: NucleusClient, interaction: CommandInteraction | ButtonInteraction | ContextMenuCommandInteraction, error: string) {
PineaFanc4d6c3f2023-01-19 12:17:25 +00009 const embed = new EmojiEmbed()
10 .setTitle("Something went wrong")
11 .setDescription(error)
12 .setStatus("Danger")
13 .setEmoji("CONTROL.BLOCKCROSS")
pineafan34369e62022-05-18 16:52:37 +010014 if (interaction.replied || interaction.deferred) {
Skyler Grey75ea9172022-08-06 10:22:23 +010015 await interaction.followUp({
PineaFanc4d6c3f2023-01-19 12:17:25 +000016 embeds: [embed],
Skyler Grey75ea9172022-08-06 10:22:23 +010017 ephemeral: true
18 });
pineafan34369e62022-05-18 16:52:37 +010019 } else {
Skyler Grey75ea9172022-08-06 10:22:23 +010020 await interaction.reply({
PineaFanc4d6c3f2023-01-19 12:17:25 +000021 embeds: [embed],
Skyler Grey75ea9172022-08-06 10:22:23 +010022 ephemeral: true
23 });
pineafan34369e62022-05-18 16:52:37 +010024 }
25}