optimization

This commit is contained in:
Mylloon 2022-07-24 15:49:20 +02:00
parent a857898300
commit 86c074c7be
Signed by: Anri
GPG key ID: A82D63DFF8D1317F
3 changed files with 5 additions and 4 deletions

View file

@ -32,9 +32,10 @@ export default async (client: Client) => {
).default; ).default;
// Add it to the collection so the interaction will work // Add it to the collection so the interaction will work
client.commands.list.set(command.data(client).name, command); command.data = command.data(client);
client.commands.list.set(command.data.name, command);
return command.data(client).toJSON(); return command.data.toJSON();
}), }),
); );
}), }),

View file

@ -32,7 +32,7 @@ export default {
const command = client.commands.list.get(command_name); const command = client.commands.list.get(command_name);
let res = `${compteur}- \`${command_name}\` : `; let res = `${compteur}- \`${command_name}\` : `;
if (command?.data) { if (command?.data) {
res += `${command.data(client).description}.\n`; res += `${command.data.description}.\n`;
} else { } else {
res += loc.get('c_help3'); res += loc.get('c_help3');
} }

View file

@ -29,7 +29,7 @@ declare module 'discord.js' {
/** Command itself */ /** Command itself */
{ {
/** Data about the command */ /** Data about the command */
data(client: Client): SlashCommandBuilder, data: SlashCommandBuilder,
/** How the command interact */ /** How the command interact */
interaction: (interaction: CommandInteraction, client: Client) => unknown interaction: (interaction: CommandInteraction, client: Client) => unknown
} }