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

Commit

Permalink
attempt #1 fixing punishments
Browse files Browse the repository at this point in the history
  • Loading branch information
RealEthanPlayzDev committed Oct 11, 2023
1 parent 7dc6e41 commit 711f0a0
Showing 1 changed file with 29 additions and 5 deletions.
34 changes: 29 additions & 5 deletions src/commands/Moderation/Punishments.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ModerationCase } from "@prisma/client";
import { ModerationAction, ModerationCase } from "@prisma/client";
import { SlashCommandBuilder, ActionRowBuilder, ButtonBuilder, ButtonStyle } from "discord.js";
import type { MeteoriumCommand } from "..";
import { MeteoriumEmbedBuilder } from "../../util/MeteoriumEmbedBuilder";
Expand Down Expand Up @@ -47,10 +47,34 @@ export const Command: MeteoriumCommand = {
});
} else {
const PunishmentPages: ModerationCase[][] = [[]];
for (let i = 1; i < Punishments.length; i++)
(i + 1) % 10 == 0
? PunishmentPages.push([Punishments[i]!])
: PunishmentPages.at(-1)!.push(Punishments[i]!);
for (let i = 1; i < Punishments.length; i++) {
const Case = Punishments[i]!
if ((i + 1) % 10 == 0) {
PunishmentPages.push([Case])
} else {
PunishmentPages.at(-1)!.push(Case);
}
switch(Case.Action) {
case ModerationAction.Ban: {
TotalBan++;
break;
}
case ModerationAction.Kick: {
TotalKick++;
break;
}
case ModerationAction.Mute: {
TotalMute++;
break;
}
case ModerationAction.Warn: {
TotalWarn++;
break;
}
default: break;
}
}
console.log(PunishmentPages);

const GeneratePageEmbed = (index: number) => {
if (PunishmentPages[index] == undefined) throw Error("invalid page index");
Expand Down

0 comments on commit 711f0a0

Please sign in to comment.