ban discord ids

pull/92/head
Aevann 2023-01-23 09:38:16 +02:00
parent 0c5c97a1f8
commit 12274b858f
2 changed files with 6 additions and 1 deletions

View File

@ -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)

View File

@ -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 '<pre>' not in sanitized and not sidebar:
sanitized = sanitized.replace('\n','')