add alias command name

This commit is contained in:
Tutur33
2024-02-17 02:02:17 +01:00
parent 0cde5ff766
commit 8bc2bbb8d8
3 changed files with 15 additions and 0 deletions
+9
View File
@@ -44,7 +44,16 @@ module.exports = {
gestion: [],
utils: [],
};
let liste = [];
for (const command of client.commands.values()) {
const existingCommand = liste.find(cmd => cmd.name === command.name);
if (!existingCommand) {
liste.push(command);
}
}
console.log(liste);
for (const command of liste) {
if (command.category) {
categories[command.category].push({ name: command.name, description: command.description, emote: command.emote, utilisation: command.utilisation});
}
+1
View File
@@ -4,6 +4,7 @@ const path = require('path');
module.exports = {
name: 'random',
aliases: ['rand'],
description: 'Affiche un nombre aléatoire entre 2 nombres donnés',
emote: '🎲',
utilisation: 'random [min] [max]',
+5
View File
@@ -16,6 +16,11 @@ module.exports = (client) => {
delete require.cache[require.resolve(filePath)];
const command = require(filePath);
client.commands.set(command.name, command);
if (command.aliases) {
command.aliases.forEach(alias => {
client.commands.set(alias, command);
});
}
count++;
} catch (error) {
console.error(`Failed to load file: ${filePath}`); // Log any errors