🧑‍💻 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
const doneImporting = async () => {
const doneImporting = () => {
if (importedCommandAmount !== amountOfCommands) {
return logger.warn(
`📦 Failed importing ${
@ -48,13 +48,9 @@ export const register = async (client: Client) => {
// Start importing commands
commandNames.forEach(async (commandName: string, index: number) => {
await importCommand(commandName)
.then(async () => {
logger.debug(`📦 Imported the "${commandName}" command`);
})
.catch(async (err) => {
logger.error(err);
});
await importCommand(commandName).then(() => {
logger.debug(`📦 Imported the "${commandName}" command`);
});
// If done importing
if (index + 1 === amountOfCommands) {

View file

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