A Discord Bot connected to your Pterodactyl API.
at main 26 lines 805 B view raw
1import { Events } from "discord.js"; 2import { Logger } from "../services/Logger.js"; 3 4export default { 5 name: Events.InteractionCreate, 6 async execute(interaction) { 7 if (!interaction.isChatInputCommand()) return; 8 const command = interaction.client.commands.get(interaction.commandName); 9 if (!command) { 10 Logger.error(`No command matching ${interaction.commandName} was found.`); 11 return; 12 } 13 try { 14 await command.execute(interaction); 15 } 16 catch (error) { 17 Logger.error(error); 18 if (interaction.replied || interaction.deferred) { 19 await interaction.followUp({ content: "There was an error while executing this command!", ephemeral: true }); 20 } 21 else { 22 await interaction.reply({ content: "There was an error while executing this command!", ephemeral: true }); 23 } 24 } 25 }, 26};