diff --git a/src/managers/command/index.ts b/src/managers/command/index.ts index 5f43be4..1816c8f 100644 --- a/src/managers/command/index.ts +++ b/src/managers/command/index.ts @@ -23,10 +23,6 @@ export const register = async (client: Client) => { throw new Error( `📦 No command builder found while importing "${commandName}"` ); - if (!command.execute) - throw new Error( - `📦 No command execute found while importing "${commandName}"` - ); if (!command.moduleData) throw new Error( `📦 No command moduleData found while importing "${commandName}"` @@ -38,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 ${ @@ -52,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) { diff --git a/src/managers/event/index.ts b/src/managers/event/index.ts index c0734ba..cf44860 100644 --- a/src/managers/event/index.ts +++ b/src/managers/event/index.ts @@ -4,6 +4,7 @@ import listDir from "../../helpers/checkDirectory"; import { IEvent } from "../../interfaces/Event"; import logger from "../../middlewares/logger"; +// Registers all available events export const register = async (client: Client) => { const eventNames = await listDir("plugins/events"); if (!eventNames) throw new Error("📦 No events available"); @@ -28,7 +29,7 @@ export const register = async (client: Client) => { // Register event const eventExecutor = async (...args: Promise[]) => { - await event.execute(...args).catch(async (err) => { + await event.execute(...args).catch((err) => { logger.error(`${err}`); }); }; @@ -44,12 +45,14 @@ export const register = async (client: Client) => { case "on": client.on(eventName, eventExecutor); break; + default: + logger.error(`${eventName} does not have a valid type`); } importedEventAmount += 1; }; // Send log message when it's done loading events - const doneImporting = async () => { + const doneImporting = () => { if (importedEventAmount !== amountOfEvents) { return logger.warn( `📦 Failed importing ${ @@ -62,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`); }); diff --git a/src/plugins/commands/counters/modules/view/index.ts b/src/plugins/commands/counters/modules/view/index.ts index 679b68e..321206c 100644 --- a/src/plugins/commands/counters/modules/view/index.ts +++ b/src/plugins/commands/counters/modules/view/index.ts @@ -46,13 +46,6 @@ export default { channelId: discordChannel.id, }); - const counters = await counterSchema.find(); - - console.log(counters, { - guildId: guild.id, - channelId: discordChannel.id, - }); - if (!counter) throw new Error("No counter found for channel"); return interaction.editReply({ diff --git a/src/plugins/commands/manage/modules/credits/modules/transfer/index.ts b/src/plugins/commands/manage/modules/credits/modules/transfer/index.ts index 2d790b8..62a9425 100644 --- a/src/plugins/commands/manage/modules/credits/modules/transfer/index.ts +++ b/src/plugins/commands/manage/modules/credits/modules/transfer/index.ts @@ -207,24 +207,13 @@ export default { await toUser.save(); await session.commitTransaction(); - } catch (error) { + } catch (error: unknown) { await session.abortTransaction(); session.endSession(); - logger.error(`${error}`); - return interaction.editReply({ - embeds: [ - new EmbedBuilder() - .setTitle("[:toolbox:] Manage - Credits (Transfer)") - .setDescription( - "An error occurred while trying to gift credits. Please try again." - ) - .setColor(errorColor) - .setTimestamp(new Date()) - .setColor(successColor) - .setFooter({ text: footerText, iconURL: footerIcon }), - ], - }); + throw new Error( + "An error occurred while trying to gift credits. Please try again later." + ); } finally { // ending the session session.endSession(); diff --git a/src/plugins/commands/shop/modules/roles/modules/cancel/index.ts b/src/plugins/commands/shop/modules/roles/modules/cancel/index.ts index a2d92d2..f3064cd 100644 --- a/src/plugins/commands/shop/modules/roles/modules/cancel/index.ts +++ b/src/plugins/commands/shop/modules/roles/modules/cancel/index.ts @@ -79,9 +79,6 @@ export default { return interaction?.editReply({ embeds: [interactionEmbed], }); - }) - .catch(async (error: Error) => { - return logger?.silly(`Role could not be deleted. ${error}`); }); }, };