Skip to content
This repository has been archived by the owner on Oct 12, 2024. It is now read-only.

Commit

Permalink
Int-CI-Moderation-CreateCase: Ban creation should check for existing …
Browse files Browse the repository at this point in the history
…active ban/tempban case
  • Loading branch information
RadiatedExodus committed Mar 11, 2024
1 parent 7cdbab3 commit 36a48da
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/interactions/commands/moderation/createCase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,23 @@ export const Command: MeteoriumChatCommand = {
content: "The user id does not match between the data specified here and the related case data.",
});

// Active ban case check
const prevBanCase = await client.db.moderationCase.findFirst({
where: {
OR: [
{ GuildId: interaction.guildId, TargetUserId: user.id, Action: ModerationAction.Ban },
{ GuildId: interaction.guildId, TargetUserId: user.id, Action: ModerationAction.TempBan },
],
},
orderBy: {
GlobalCaseId: "desc",
},
});
if (prevBanCase && prevBanCase.Active)
return await interaction.editReply({
content: "This user currently has a active ban/tempban case.",
});

// Generate embed
const embed = await client.dbUtils.generateCaseEmbedFromData(
{
Expand Down

0 comments on commit 36a48da

Please sign in to comment.