More mention filtering (#2081)

* more filters

* note to future people touching this

* chan mentions were almost missed...

* Swap strategies as the previous escaped the mention, while still pinging the user/role
This commit is contained in:
Michael H
2018-09-03 22:59:59 -04:00
committed by Toby Harradine
parent d71c334a34
commit 9495432b8f
2 changed files with 26 additions and 1 deletions

View File

@@ -12,7 +12,7 @@ from .checks import mod_or_voice_permissions, admin_or_voice_permissions, bot_ha
from redbot.core.utils.mod import is_mod_or_superior, is_allowed_by_hierarchy, get_audit_reason
from .log import log
from redbot.core.utils.common_filters import filter_invites
from redbot.core.utils.common_filters import filter_invites, filter_various_mentions
_ = Translator("Mod", __file__)
@@ -1323,9 +1323,11 @@ class Mod:
if roles is not None:
data.add_field(name=_("Roles"), value=roles, inline=False)
if names:
# May need sanitizing later, but mentions do not ping in embeds currently
val = filter_invites(", ".join(names))
data.add_field(name=_("Previous Names"), value=val, inline=False)
if nicks:
# May need sanitizing later, but mentions do not ping in embeds currently
val = filter_invites(", ".join(nicks))
data.add_field(name=_("Previous Nicknames"), value=val, inline=False)
if voice_state and voice_state.channel:
@@ -1369,6 +1371,7 @@ class Mod:
msg += "\n"
msg += ", ".join(nicks)
if msg:
msg = filter_various_mentions(msg)
await ctx.send(msg)
else:
await ctx.send(_("That user doesn't have any recorded name or nickname change."))