diff options
author | IRONM00N <64110067+IRONM00N@users.noreply.github.com> | 2022-06-19 16:59:49 -0400 |
---|---|---|
committer | IRONM00N <64110067+IRONM00N@users.noreply.github.com> | 2022-06-19 16:59:49 -0400 |
commit | f580e41111a9332a4a74b63118dc94efa216c388 (patch) | |
tree | 97af802a74d7d03a0d850b98c1de1ef8612cc3bb /src/lib | |
parent | e99cc791200d1ae24b2bb99dfd80aa0c5e7f4c52 (diff) | |
download | tanzanite-f580e41111a9332a4a74b63118dc94efa216c388.tar.gz tanzanite-f580e41111a9332a4a74b63118dc94efa216c388.tar.bz2 tanzanite-f580e41111a9332a4a74b63118dc94efa216c388.zip |
refactoring and spelling fixes
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/common/AutoMod.ts | 22 | ||||
-rw-r--r-- | src/lib/common/ButtonPaginator.ts | 21 | ||||
-rw-r--r-- | src/lib/common/ConfirmationPrompt.ts | 20 | ||||
-rw-r--r-- | src/lib/common/DeleteButton.ts | 12 |
4 files changed, 19 insertions, 56 deletions
diff --git a/src/lib/common/AutoMod.ts b/src/lib/common/AutoMod.ts index 0910352..970fecd 100644 --- a/src/lib/common/AutoMod.ts +++ b/src/lib/common/AutoMod.ts @@ -25,16 +25,14 @@ export class AutoMod { /** * @param message The message to check and potentially perform automod actions to */ - public constructor( - /** - * The message to check for blacklisted phrases on - */ - private message: Message - ) { + public constructor(private message: Message) { if (message.author.id === message.client.user?.id) return; void this.handle(); } + /** + * Whether or not the message author is immune to auto moderation + */ private get isImmune() { if (!this.message.inGuild()) return false; assert(this.message.member); @@ -245,9 +243,9 @@ export class AutoMod { } /** - * Punishes the user based on the severity of the offence - * @param highestOffence The highest offence to punish the user for - * @returns The color of the embed that the log should, based on the severity of the offence + * Punishes the user based on the severity of the offense + * @param highestOffence The highest offense to punish the user for + * @returns The color of the embed that the log should, based on the severity of the offense */ private punish(highestOffence: BadWordDetails) { let color; @@ -315,9 +313,9 @@ export class AutoMod { * Log an automod infraction to the guild's specified automod log channel * @param highestOffence The highest severity word found in the message * @param color The color that the log embed should be (based on the severity) - * @param offences The other offences that were also matched in the message + * @param offenses The other offenses that were also matched in the message */ - private async log(highestOffence: BadWordDetails, color: number, offences: BadWordDetails[]) { + private async log(highestOffence: BadWordDetails, color: number, offenses: BadWordDetails[]) { void this.message.client.console.info( 'autoMod', `Severity <<${highestOffence.severity}>> action performed on <<${this.message.author.tag}>> (<<${ @@ -332,7 +330,7 @@ export class AutoMod { .setDescription( `**User:** ${this.message.author} (${this.message.author.tag})\n**Sent From:** <#${ this.message.channel.id - }> [Jump to context](${this.message.url})\n**Blacklisted Words:** ${offences.map((o) => `\`${o.match}\``).join(', ')}` + }> [Jump to context](${this.message.url})\n**Blacklisted Words:** ${offenses.map((o) => `\`${o.match}\``).join(', ')}` ) .addFields([ { name: 'Message Content', value: `${await this.message.client.utils.codeblock(this.message.content, 1024)}` } diff --git a/src/lib/common/ButtonPaginator.ts b/src/lib/common/ButtonPaginator.ts index 708b374..ed6743e 100644 --- a/src/lib/common/ButtonPaginator.ts +++ b/src/lib/common/ButtonPaginator.ts @@ -25,31 +25,16 @@ export class ButtonPaginator { protected sentMessage: Message | undefined; /** - * @param message The message to respond to + * @param message The message that triggered the command * @param embeds The embeds to switch between - * @param text The text send with the embeds (optional) - * @param deleteOnExit Whether to delete the message when the exit button is clicked (defaults to true) + * @param text The optional text to send with the paginator + * @param {} [deleteOnExit=true] Whether the paginator message gets deleted when the exit button is pressed * @param startOn The page to start from (**not** the index) */ protected constructor( - /** - * The message that triggered the command - */ protected message: CommandMessage | SlashMessage, - - /** - * The embeds to paginate - */ protected embeds: EmbedBuilder[] | APIEmbed[], - - /** - * The optional text to send with the paginator - */ protected text: string | null, - - /** - * Whether the paginator message gets deleted when the exit button is pressed - */ protected deleteOnExit: boolean, startOn: number ) { diff --git a/src/lib/common/ConfirmationPrompt.ts b/src/lib/common/ConfirmationPrompt.ts index 38d078a..4bea092 100644 --- a/src/lib/common/ConfirmationPrompt.ts +++ b/src/lib/common/ConfirmationPrompt.ts @@ -6,20 +6,10 @@ import { ActionRowBuilder, ButtonBuilder, ButtonStyle, type MessageComponentInte */ export class ConfirmationPrompt { /** - * @param message The message to respond to - * @param messageOptions The send message options + * @param message The message that triggered the command + * @param messageOptions Options for sending the message */ - protected constructor( - /** - * The message that triggered the command - */ - protected message: CommandMessage | SlashMessage, - - /** - * Options for sending the message - */ - protected messageOptions: MessageOptions - ) {} + protected constructor(protected message: CommandMessage | SlashMessage, protected messageOptions: MessageOptions) {} /** * Sends a message with buttons for the user to confirm or cancel the action. @@ -65,8 +55,8 @@ export class ConfirmationPrompt { /** * Sends a message with buttons for the user to confirm or cancel the action. - * @param message The message to respond to - * @param options The send message options + * @param message The message that triggered the command + * @param sendOptions Options for sending the message */ public static async send(message: CommandMessage | SlashMessage, sendOptions: MessageOptions): Promise<boolean> { return new ConfirmationPrompt(message, sendOptions).send(); diff --git a/src/lib/common/DeleteButton.ts b/src/lib/common/DeleteButton.ts index bc0da17..556bc07 100644 --- a/src/lib/common/DeleteButton.ts +++ b/src/lib/common/DeleteButton.ts @@ -18,17 +18,7 @@ export class DeleteButton { * @param message The message to respond to * @param messageOptions The send message options */ - protected constructor( - /** - * The message that triggered the command - */ - protected message: CommandMessage | SlashMessage, - - /** - * Options for sending the message - */ - protected messageOptions: MessageOptions - ) {} + protected constructor(protected message: CommandMessage | SlashMessage, protected messageOptions: MessageOptions) {} /** * Sends a message with a button for the user to delete it. |