Move eventhandlers to separate files

This commit is contained in:
Minzkraut
2022-04-13 16:53:26 +02:00
parent 7486a38a2d
commit 0c351c1037
3 changed files with 64 additions and 44 deletions

View File

@@ -0,0 +1,24 @@
require("dotenv").config();
const { REST } = require("@discordjs/rest");
const { Routes } = require("discord-api-types/v9")
module.exports = {
name: "interactionCreate",
async execute (interaction) {
if (!interaction.isCommand()) return;
const command = interaction.client.commands.get(interaction.commandName);
if (!command) return;
try {
await command.execute(interaction);
} catch (err) {
if (err) console.log(err);
await interaction.reply({
content: "An error occured processing the command",
ephemeral: true
});
}
}
}