Removing unsupported escape character

This commit is contained in:
AllfatherHatt 2025-05-18 13:07:11 +02:00
parent a5ef741ad7
commit 7a9313d5a5

View File

@ -51,13 +51,16 @@ QUESTIONS_LIST = [
def sanitize_input(input_text: str) -> str:
"""Sanitize input to remove mentions, links, and unwanted special characters."""
# Remove user/role/channel mentions
text = re.sub(r'<@!?(?:&)?\d+>', '', input_text)
# Remove URLs
text = re.sub(r'http\S+', '', text)
# Allow unicode letters and common punctuation
text = re.sub(r'[^\w\s\p{L}\.,\?!`~@#$%^&*()_+=-]', '', text)
# Keep only word characters (including Unicode letters/digits), whitespace, and your chosen punctuation
text = re.sub(r"[^\w\s\.,\?!`~@#$%^&*()_+=-]", "", text)
return text
class Recruitment(commands.Cog): # noqa
"""A cog that lets a user send a membership application."""