[commands] Ensure no mentions escape clean_content

Some clever nicknames or role names would lead themselves to
resolving to pings.
This commit is contained in:
Rapptz 2017-08-10 03:15:19 -04:00
parent cb709cc9da
commit eb673ec2af

View File

@ -436,13 +436,5 @@ class clean_content(Converter):
pattern = re.compile('|'.join(transformations.keys()))
result = pattern.sub(replace, result)
transformations = {
'@everyone': '@\u200beveryone',
'@here': '@\u200bhere'
}
def repl2(obj):
return transformations.get(obj.group(0), '')
pattern = re.compile('|'.join(transformations.keys()))
return pattern.sub(repl2, result)
# Completely ensure no mentions escape:
return re.sub(r'@(everyone|here|[!&]?[0-9]{17,21})', '@\u200b\\1', result)