Added Basic Discord Connectivity

This commit is contained in:
DeSqBlocki
2025-02-08 16:47:07 +01:00
parent 8292db72e3
commit bd782b0567
14 changed files with 511 additions and 333 deletions
+26
View File
@@ -0,0 +1,26 @@
const { Events } = require('discord.js')
module.exports = {
name: Events.InteractionCreate,
once: false,
async execute(interaction) {
if (!interaction.isChatInputCommand()) return;
const command = interaction.client.commands.get(interaction.commandName);
if (!command) {
console.error(`No command matching ${interaction.commandName} was found.`);
return;
}
try {
await command.execute(interaction);
} catch (error) {
console.error(error);
if (interaction.replied || interaction.deferred) {
await interaction.followUp({ content: 'There was an error while executing this command!', ephemeral: true });
} else {
await interaction.reply({ content: 'There was an error while executing this command!', ephemeral: true });
}
}
}
}