Skip to content

Commit

Permalink
Reduce logic further
Browse files Browse the repository at this point in the history
  • Loading branch information
Half-Shot committed Sep 20, 2024
1 parent a51cd63 commit 0c75c17
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/protections/MentionSpam.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,8 @@ export class MentionSpam extends Protection {

public checkMentions(body: unknown|undefined, htmlBody: unknown|undefined, mentionArray: unknown|undefined): boolean {
const max = this.settings.maxMentions.value;
if (Array.isArray(mentionArray)) {
if (mentionArray.length > this.settings.maxMentions.value) {
return true;
}
if (Array.isArray(mentionArray) && mentionArray.length > max) {
return true;
}
if (typeof body === "string" && body.split('@').length - 1 > max) {
return true;
Expand Down

0 comments on commit 0c75c17

Please sign in to comment.