abstract away prefix + ev cmd
All checks were successful
Deploy bot / build-and-deploy (push) Successful in 14s

This commit is contained in:
2025-08-08 17:03:24 +02:00
parent a57aa17deb
commit 1009165751
14 changed files with 226 additions and 51 deletions

View File

@ -20,6 +20,7 @@ const client = new Client({
});
client.commands = new Collection();
client.ownerID = 263247134147608578;
client.prefix = prefix;
fs.readdir("./commands/", (err, files) => {
if (err) return console.error(err);
@ -73,8 +74,13 @@ client.on(Events.MessageCreate, async (message) => {
const cmd = client.commands.get(command);
if (!cmd) return;
await cmd.run(client, message, args);
try {
await cmd.run(client, message, args);
} catch (e) {
message.channel.send(
"Command " + cmd.name + " exited with an exception: " + e
);
}
});
// Log in to Discord with your client's token