Add ability to have aliases for dotCommands

This commit is contained in:
Skylar Grant 2022-06-11 10:55:13 -04:00
parent 41be4672fa
commit 67f508f5e6
1 changed files with 9 additions and 2 deletions

View File

@ -54,8 +54,12 @@ const functions = {
if (isDev) console.log('Slash Commands Collection Built'); if (isDev) console.log('Slash Commands Collection Built');
}, },
setvalidCommands(client) { setvalidCommands(client) {
for (const entry of client.dotCommands.map(command => command.name)) { for (const entry of client.dotCommands.map(command => command)) {
config.validCommands.push(entry); config.validCommands.push(entry.name);
if (entry.alias != undefined) {
config.validCommands.push(entry.alias);
}
} }
if (isDev) console.log('Valid Commands Added to Config'); if (isDev) console.log('Valid Commands Added to Config');
}, },
@ -65,6 +69,9 @@ const functions = {
for (const file of dotCommandFiles) { for (const file of dotCommandFiles) {
const dotCommand = require(`./dot-commands/${file}`); const dotCommand = require(`./dot-commands/${file}`);
client.dotCommands.set(dotCommand.name, dotCommand); client.dotCommands.set(dotCommand.name, dotCommand);
if (dotCommand.alias != undefined) {
client.dotCommands.set(dotCommand.alias, dotCommand);
}
} }
if (isDev) console.log('Dot Commands Collection Built'); if (isDev) console.log('Dot Commands Collection Built');
}, },