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