Skip to content

Commit

Permalink
don't break when badWords arrays are empty (#282)
Browse files Browse the repository at this point in the history
Co-authored-by: pufferfish101007 <pufferfish101007@users.noreply.github.com>
  • Loading branch information
pufferfish101007 and pufferfish101007 committed Jul 22, 2023
1 parent 51f1291 commit ad6fe62
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions modules/automod/language.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ function decodeRegexes(regexes: RegExp[]) {
export const badWordRegexps = badWords.map(
([strings = [], words = [], prefixes = []]) =>
new RegExp(
(strings.length ? `${decodeRegexes(strings)}|` : "") +
`\\b(?:${words.length ? `(?:${decodeRegexes(words)})\\b` : ""}${
prefixes.length ? `|${decodeRegexes(prefixes)}` : ""
(strings.length ? `${decodeRegexes(strings)}|` : "(?!x)x") +
`\\b(?:${words.length ? `(?:${decodeRegexes(words)})\\b` : "(?!x)x"}${
prefixes.length ? `|${decodeRegexes(prefixes)}` : "(?!x)x"
})`,
"gi",
),
Expand Down

0 comments on commit ad6fe62

Please sign in to comment.