diff --git a/files/helpers/regex.py b/files/helpers/regex.py index a3fb42f7f..4f2505c51 100644 --- a/files/helpers/regex.py +++ b/files/helpers/regex.py @@ -180,7 +180,7 @@ commands = { "roll": range(1, 9999) } -command_regex = re.compile("(\s|\n|^)#(fortune|factcheck|8ball|roll)", flags=re.A|re.I) +command_regex = re.compile("(\s|^)#(fortune|factcheck|8ball|roll)", flags=re.A|re.I) def command_regex_matcher(match, upper=False): result = str(choice(commands[match.group(2).lower()])) @@ -190,3 +190,5 @@ def command_regex_matcher(match, upper=False): return match.group(1) + result reason_regex = re.compile('(/(post|comment)/[0-9]+)', flags=re.A) + +discord_username_regex = re.compile("(\s|^).{2,32}#[0-9]{4}(?=\s|$)", flags=re.A) diff --git a/files/helpers/sanitize.py b/files/helpers/sanitize.py index e7c5fb735..ef95632a0 100644 --- a/files/helpers/sanitize.py +++ b/files/helpers/sanitize.py @@ -420,6 +420,9 @@ def sanitize(sanitized, golden=True, limit_pings=0, showmore=True, count_marseys if y.startswith(x.domain): abort(403, f'Remove the banned link "{x.domain}" and try again!\nReason for link ban: "{x.reason}"') + if discord_username_regex.match(sanitized): + abort(403, "Stop grooming!") + if '
' not in sanitized and not sidebar:
 		sanitized = sanitized.replace('\n','')