diff --git a/src/commands/mod/punishment.ts b/src/commands/mod/punishment.ts index 1f20258..fe5abf5 100644 --- a/src/commands/mod/punishment.ts +++ b/src/commands/mod/punishment.ts @@ -34,6 +34,14 @@ export namespace types { interaction: ChatInputCommandInteraction ) => Promise>; export type SubCommands = { + /** + * List all punishments of a user. + * @param guild The guild of the punishments. + * @param user The user to get the punishments of. + * @param pageNumber The page number of the list. + * @param createdAt The date of the list. + * @returns A promise that resolves with an APIEmbed if no error occurs, otherwise a BotErr. + */ list: ( guild: Guild, user: User, diff --git a/src/lib/system/handlers/punishmentHandler.ts b/src/lib/system/handlers/punishmentHandler.ts index 00fd20e..28138ac 100644 --- a/src/lib/system/handlers/punishmentHandler.ts +++ b/src/lib/system/handlers/punishmentHandler.ts @@ -18,6 +18,17 @@ export class PunishmentHandler { this.guild = guild; } + /** + * Adds a punishment to a user. + * @param userId The ID of the user to punish. + * @param moderatorId The ID of the moderator who is punishing. + * @param type The type of punishment. + * @param reason The reason why the user is being punished. + * @param createdAt The time when the punishment is created. + * @param expiresAt The time when the punishment expires. + * @returns A promise that resolves with an Ok containing + * void if no error occurs, otherwise a BotErr. + */ public async add( userId: Snowflake, moderatorId: Snowflake, @@ -80,6 +91,12 @@ export class PunishmentHandler { return Ok(punishments); } + /** + * Get a punishment by its case number. + * @param caseNumber The case number of the punishment to get. + * @returns A promise that resolves with an Ok containing the punishment if no error occurs, + * otherwise a BotErr. + */ public async get(caseNumber: number): Promise> { const getPunishment = await prisma.userPunishment.findFirst({ where: { case: caseNumber, guildId: this.guild.id },