mirror of
https://github.com/darksaid98/cadence-discord-bot.git
synced 2026-12-03 06:28:53 +00:00
feat: Added reload command
This commit is contained in:
1 parent
7c43daeb9b
commit
2c5d5ec3a5
3 files changed
+52
-2
No files matched your search
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user