From 1d04890c9246f06c9f44b5960e1054f15f663354 Mon Sep 17 00:00:00 2001 From: Vermium Sifell Date: Fri, 14 Oct 2022 11:51:15 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=A7=91=E2=80=8D=F0=9F=92=BB=20Fixed=20som?= =?UTF-8?q?e=20code=20smelling?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/plugins/commands/credits/modules/gift/index.ts | 13 ++----------- src/plugins/commands/credits/modules/work/index.ts | 2 +- 2 files changed, 3 insertions(+), 12 deletions(-) diff --git a/src/plugins/commands/credits/modules/gift/index.ts b/src/plugins/commands/credits/modules/gift/index.ts index 9161cad..0f36ee9 100644 --- a/src/plugins/commands/credits/modules/gift/index.ts +++ b/src/plugins/commands/credits/modules/gift/index.ts @@ -3,7 +3,7 @@ import { ChatInputCommandInteraction, EmbedBuilder, - SlashCommandSubcommandBuilder, + SlashCommandSubcommandBuilder } from "discord.js"; import mongoose from "mongoose"; // Configurations @@ -200,17 +200,8 @@ export default { } catch (error) { await session.abortTransaction(); session.endSession(); - logger.error(`${error}`); - return interaction.editReply({ - embeds: [ - embed - .setDescription( - "An error occurred while trying to gift credits. Please try again." - ) - .setColor(errorColor), - ], - }); + thorw 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/credits/modules/work/index.ts b/src/plugins/commands/credits/modules/work/index.ts index e1fcbc3..d9be719 100644 --- a/src/plugins/commands/credits/modules/work/index.ts +++ b/src/plugins/commands/credits/modules/work/index.ts @@ -56,7 +56,7 @@ export default { userDB.credits += creditsEarned; - await userDB?.save()?.then(async () => { + await userDB?.save()?.then(() => { logger?.silly( `User ${userDB?.userId} worked and earned ${creditsEarned} credits` );