From c735509f57786a46aac6be2bbfe58319af08771a Mon Sep 17 00:00:00 2001 From: smyalygames Date: Sat, 11 Feb 2023 01:53:24 +0000 Subject: [PATCH] fix(arabot): fix logic for checkActive --- src/utils/database/vcMute.ts | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/utils/database/vcMute.ts b/src/utils/database/vcMute.ts index 3cb4bf7..e57e63b 100644 --- a/src/utils/database/vcMute.ts +++ b/src/utils/database/vcMute.ts @@ -21,7 +21,7 @@ export async function addMute(userId: Snowflake, modId: Snowflake, reason: strin } export async function removeMute(userId: Snowflake) { - const ban = await container.database.vCMute.findFirst({ + const mute = await container.database.vCMute.findFirst({ where: { userId, }, @@ -33,14 +33,14 @@ export async function removeMute(userId: Snowflake) { }, }); - if (ban === null) { + if (mute === null) { return; } // Query to deactivate the specific sus note await container.database.vCMute.update({ where: { - id: ban.id, + id: mute.id, }, data: { endTime: new Date(), @@ -49,7 +49,7 @@ export async function removeMute(userId: Snowflake) { } export async function checkActive(userId: Snowflake) { - const ban = await container.database.vCMute.findFirst({ + const mute = await container.database.vCMute.findFirst({ where: { userId, }, @@ -61,6 +61,9 @@ export async function checkActive(userId: Snowflake) { }, }); - return !(ban === null - || ban.endTime === null); + if (mute === null) { + return false; + } + + return mute.endTime === null; }