feat: Added reload command

This commit is contained in:
Marius Begby committed 2023-07-27 19:22:47 +02:00
1 parent 7c43daeb9b
commit 2c5d5ec3a5
3 files changed
+52 -2

No files matched your search

+7 -2
View File
@@ -15,14 +15,19 @@ exports.registerClientCommands = (client) => {
for (const file of commandFiles) {
try {
logger.debug(`[Shard ${client.shard.ids[0]}] Registering command ${folder}/${file}...`);
logger.trace(`[Shard ${client.shard.ids[0]}] Registering command ${folder}/${file}...`);
// delete command from require cache
delete require.cache[require.resolve(`../commands/${folder}/${file}`)];
// register command
const command = require(`../commands/${folder}/${file}`);
client.commands.delete(command.data.name);
client.commands.set(command.data.name, command);
} catch (error) {
logger.error(
`[Shard ${client.shard.ids[0]}] Error registering command ${folder}/${file}: ${error.message}`
);
throw error;
}
}
}