From 813f531c05065f38b35dd53c3c0aed3bed4f77f5 Mon Sep 17 00:00:00 2001 From: jack1142 <6032823+jack1142@users.noreply.github.com> Date: Mon, 24 Feb 2020 18:03:01 +0100 Subject: [PATCH] [ForceMention] Disable role mention auto-sanitizer when sending pinging message (#79) * Update forcemention.py * it's gonna be a minor bump after all --- forcemention/forcemention.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/forcemention/forcemention.py b/forcemention/forcemention.py index c9f0c5d..0bf2a61 100644 --- a/forcemention/forcemention.py +++ b/forcemention/forcemention.py @@ -1,5 +1,6 @@ from discord.utils import get +from redbot import VersionInfo, version_info from redbot.core import Config, checks, commands from redbot.core.bot import Red @@ -8,6 +9,10 @@ import asyncio Cog: Any = getattr(commands, "Cog", object) +if version_info < VersionInfo.from_str("3.4.0"): + SANITIZE_ROLES_KWARG = {} +else: + SANITIZE_ROLES_KWARG = {"sanitize_roles": False} class ForceMention(Cog): """ @@ -36,8 +41,8 @@ class ForceMention(Cog): if not role_obj.mentionable: await role_obj.edit(mentionable=True) - await ctx.send("{}\n{}".format(role_obj.mention, message)) + await ctx.send("{}\n{}".format(role_obj.mention, message), **SANITIZE_ROLES_KWARG) await asyncio.sleep(5) await role_obj.edit(mentionable=False) else: - await ctx.send("{}\n{}".format(role_obj.mention, message)) + await ctx.send("{}\n{}".format(role_obj.mention, message), **SANITIZE_ROLES_KWARG)