Skip to content

Commit

Permalink
docs: add jsdoc to some functions with AI (#24)
Browse files Browse the repository at this point in the history
  • Loading branch information
dmyna committed Sep 7, 2024
1 parent 4c6b736 commit 9ab37f9
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/commands/mod/punishment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,14 @@ export namespace types {
interaction: ChatInputCommandInteraction
) => Promise<Result<void>>;
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,
Expand Down
17 changes: 17 additions & 0 deletions src/lib/system/handlers/punishmentHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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<Result<UserPunishment>> {
const getPunishment = await prisma.userPunishment.findFirst({
where: { case: caseNumber, guildId: this.guild.id },
Expand Down

0 comments on commit 9ab37f9

Please sign in to comment.