mirror of
https://github.com/arthur-pbty/gestion.git
synced 2026-06-12 23:59:20 +02:00
add alias command name
This commit is contained in:
@@ -44,7 +44,16 @@ module.exports = {
|
|||||||
gestion: [],
|
gestion: [],
|
||||||
utils: [],
|
utils: [],
|
||||||
};
|
};
|
||||||
|
|
||||||
|
let liste = [];
|
||||||
for (const command of client.commands.values()) {
|
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) {
|
if (command.category) {
|
||||||
categories[command.category].push({ name: command.name, description: command.description, emote: command.emote, utilisation: command.utilisation});
|
categories[command.category].push({ name: command.name, description: command.description, emote: command.emote, utilisation: command.utilisation});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ const path = require('path');
|
|||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
name: 'random',
|
name: 'random',
|
||||||
|
aliases: ['rand'],
|
||||||
description: 'Affiche un nombre aléatoire entre 2 nombres donnés',
|
description: 'Affiche un nombre aléatoire entre 2 nombres donnés',
|
||||||
emote: '🎲',
|
emote: '🎲',
|
||||||
utilisation: 'random [min] [max]',
|
utilisation: 'random [min] [max]',
|
||||||
|
|||||||
@@ -16,6 +16,11 @@ module.exports = (client) => {
|
|||||||
delete require.cache[require.resolve(filePath)];
|
delete require.cache[require.resolve(filePath)];
|
||||||
const command = require(filePath);
|
const command = require(filePath);
|
||||||
client.commands.set(command.name, command);
|
client.commands.set(command.name, command);
|
||||||
|
if (command.aliases) {
|
||||||
|
command.aliases.forEach(alias => {
|
||||||
|
client.commands.set(alias, command);
|
||||||
|
});
|
||||||
|
}
|
||||||
count++;
|
count++;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(`Failed to load file: ${filePath}`); // Log any errors
|
console.error(`Failed to load file: ${filePath}`); // Log any errors
|
||||||
|
|||||||
Reference in New Issue
Block a user