mirror of
https://github.com/arthur-pbty/gestion-perso.git
synced 2026-06-12 08:14:35 +02:00
add anti crash + command
This commit is contained in:
@@ -12,11 +12,12 @@ module.exports = function loadCommands(client: any, dir: string) {
|
||||
delete require.cache[require.resolve(filePath)];
|
||||
const command = require(filePath);
|
||||
const fileName = file.replace(/\.js|\.ts/g, '');
|
||||
command.name = fileName;
|
||||
if (!command.name) command.name = fileName;
|
||||
if (!command.category) {
|
||||
const parentDir = path.basename(path.dirname(filePath));
|
||||
command.category = parentDir === 'commands' ? 'other' : parentDir;
|
||||
}
|
||||
if (!command.permission) command.permission = 0;
|
||||
client.commands.set(fileName, command);
|
||||
if (command.aliases) {
|
||||
command.aliases.forEach((alias: string) => {
|
||||
|
||||
Reference in New Issue
Block a user