PineaFan | 9b2ac4d | 2023-01-18 14:41:07 +0000 | [diff] [blame^] | 1 | import type { ButtonInteraction, ContextMenuCommandInteraction } from 'discord.js'; |
| 2 | import type { CommandInteraction } from 'discord.js'; |
| 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 | |
PineaFan | 9b2ac4d | 2023-01-18 14:41:07 +0000 | [diff] [blame^] | 8 | export async function callback(_: NucleusClient, interaction: CommandInteraction | ButtonInteraction | ContextMenuCommandInteraction, error: string) { |
pineafan | 34369e6 | 2022-05-18 16:52:37 +0100 | [diff] [blame] | 9 | if (interaction.replied || interaction.deferred) { |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 10 | await interaction.followUp({ |
| 11 | embeds: [ |
| 12 | new EmojiEmbed() |
| 13 | .setTitle("Something went wrong") |
PineaFan | 9b2ac4d | 2023-01-18 14:41:07 +0000 | [diff] [blame^] | 14 | .setDescription(error) |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 15 | .setStatus("Danger") |
| 16 | .setEmoji("CONTROL.BLOCKCROSS") |
| 17 | ], |
| 18 | ephemeral: true |
| 19 | }); |
pineafan | 34369e6 | 2022-05-18 16:52:37 +0100 | [diff] [blame] | 20 | } else { |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 21 | await interaction.reply({ |
| 22 | embeds: [ |
| 23 | new EmojiEmbed() |
| 24 | .setTitle("Something went wrong") |
PineaFan | 9b2ac4d | 2023-01-18 14:41:07 +0000 | [diff] [blame^] | 25 | .setDescription(error) |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 26 | .setStatus("Danger") |
| 27 | .setEmoji("CONTROL.BLOCKCROSS") |
| 28 | ], |
| 29 | ephemeral: true |
| 30 | }); |
pineafan | 34369e6 | 2022-05-18 16:52:37 +0100 | [diff] [blame] | 31 | } |
| 32 | } |