mirror of
https://github.com/veganhacktivists/arabot.git
synced 2025-09-18 22:12:21 +02:00
fix(arabot): fix logic for checkActive
This commit is contained in:
parent
ecf75b63e7
commit
c735509f57
@ -21,7 +21,7 @@ export async function addMute(userId: Snowflake, modId: Snowflake, reason: strin
|
|||||||
}
|
}
|
||||||
|
|
||||||
export async function removeMute(userId: Snowflake) {
|
export async function removeMute(userId: Snowflake) {
|
||||||
const ban = await container.database.vCMute.findFirst({
|
const mute = await container.database.vCMute.findFirst({
|
||||||
where: {
|
where: {
|
||||||
userId,
|
userId,
|
||||||
},
|
},
|
||||||
@ -33,14 +33,14 @@ export async function removeMute(userId: Snowflake) {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
if (ban === null) {
|
if (mute === null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Query to deactivate the specific sus note
|
// Query to deactivate the specific sus note
|
||||||
await container.database.vCMute.update({
|
await container.database.vCMute.update({
|
||||||
where: {
|
where: {
|
||||||
id: ban.id,
|
id: mute.id,
|
||||||
},
|
},
|
||||||
data: {
|
data: {
|
||||||
endTime: new Date(),
|
endTime: new Date(),
|
||||||
@ -49,7 +49,7 @@ export async function removeMute(userId: Snowflake) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export async function checkActive(userId: Snowflake) {
|
export async function checkActive(userId: Snowflake) {
|
||||||
const ban = await container.database.vCMute.findFirst({
|
const mute = await container.database.vCMute.findFirst({
|
||||||
where: {
|
where: {
|
||||||
userId,
|
userId,
|
||||||
},
|
},
|
||||||
@ -61,6 +61,9 @@ export async function checkActive(userId: Snowflake) {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
return !(ban === null
|
if (mute === null) {
|
||||||
|| ban.endTime === null);
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return mute.endTime === null;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user