Skip to content

Commit

Permalink
slash command execution parity with main bot
Browse files Browse the repository at this point in the history
  • Loading branch information
3vorp committed Jun 26, 2024
1 parent c7025cd commit 8e66cad
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions events/slashCommandUsed.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,15 @@ module.exports = {
name: "slashCommandUsed",
/** @param {import("discord.js").ChatInputCommandInteraction} interaction */
async execute(interaction) {
if (!client.commands.has(interaction.commandName)) return;
/** @type {import("@helpers/jsdoc").Command} */
const command = await interaction.client.commands.get(interaction.commandName);
if (!command) return;

// ! await required for try catch support
try {
await command.execute(interaction);
} catch (error) {
handleError(interaction.client, error, "A command failed to run!");
handleError(interaction.client, error, "Slash Command Error");

const embed = new EmbedBuilder()
.setColor(settings.colors.red)
Expand Down

0 comments on commit 8e66cad

Please sign in to comment.