🧑‍💻 Fixed some more code smells

This commit is contained in:
Axel Olausson Holtenäs 2022-10-14 11:43:43 +02:00
parent 38d192207d
commit dd7d31c571
2 changed files with 7 additions and 11 deletions

View file

@ -34,7 +34,7 @@ export const register = async (client: Client) => {
}; };
// Send log message when it's done loading commands // Send log message when it's done loading commands
const doneImporting = async () => { const doneImporting = () => {
if (importedCommandAmount !== amountOfCommands) { if (importedCommandAmount !== amountOfCommands) {
return logger.warn( return logger.warn(
`📦 Failed importing ${ `📦 Failed importing ${
@ -48,13 +48,9 @@ export const register = async (client: Client) => {
// Start importing commands // Start importing commands
commandNames.forEach(async (commandName: string, index: number) => { commandNames.forEach(async (commandName: string, index: number) => {
await importCommand(commandName) await importCommand(commandName).then(() => {
.then(async () => { logger.debug(`📦 Imported the "${commandName}" command`);
logger.debug(`📦 Imported the "${commandName}" command`); });
})
.catch(async (err) => {
logger.error(err);
});
// If done importing // If done importing
if (index + 1 === amountOfCommands) { if (index + 1 === amountOfCommands) {

View file

@ -29,7 +29,7 @@ export const register = async (client: Client) => {
// Register event // Register event
const eventExecutor = async (...args: Promise<void>[]) => { const eventExecutor = async (...args: Promise<void>[]) => {
await event.execute(...args).catch(async (err) => { await event.execute(...args).catch((err) => {
logger.error(`${err}`); logger.error(`${err}`);
}); });
}; };
@ -52,7 +52,7 @@ export const register = async (client: Client) => {
}; };
// Send log message when it's done loading events // Send log message when it's done loading events
const doneImporting = async () => { const doneImporting = () => {
if (importedEventAmount !== amountOfEvents) { if (importedEventAmount !== amountOfEvents) {
return logger.warn( return logger.warn(
`📦 Failed importing ${ `📦 Failed importing ${
@ -65,7 +65,7 @@ export const register = async (client: Client) => {
}; };
eventNames.forEach(async (eventName: string, index: number) => { eventNames.forEach(async (eventName: string, index: number) => {
await importEvent(eventName).then(async () => { await importEvent(eventName).then(() => {
logger.debug(`📦 Imported the "${eventName}" event`); logger.debug(`📦 Imported the "${eventName}" event`);
}); });