[ForceMention] Disable role mention auto-sanitizer when sending pinging message (#79)
* Update forcemention.py * it's gonna be a minor bump after all
This commit is contained in:
parent
3d077704c8
commit
813f531c05
@ -1,5 +1,6 @@
|
|||||||
from discord.utils import get
|
from discord.utils import get
|
||||||
|
|
||||||
|
from redbot import VersionInfo, version_info
|
||||||
from redbot.core import Config, checks, commands
|
from redbot.core import Config, checks, commands
|
||||||
|
|
||||||
from redbot.core.bot import Red
|
from redbot.core.bot import Red
|
||||||
@ -8,6 +9,10 @@ import asyncio
|
|||||||
|
|
||||||
Cog: Any = getattr(commands, "Cog", object)
|
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):
|
class ForceMention(Cog):
|
||||||
"""
|
"""
|
||||||
@ -36,8 +41,8 @@ class ForceMention(Cog):
|
|||||||
|
|
||||||
if not role_obj.mentionable:
|
if not role_obj.mentionable:
|
||||||
await role_obj.edit(mentionable=True)
|
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 asyncio.sleep(5)
|
||||||
await role_obj.edit(mentionable=False)
|
await role_obj.edit(mentionable=False)
|
||||||
else:
|
else:
|
||||||
await ctx.send("{}\n{}".format(role_obj.mention, message))
|
await ctx.send("{}\n{}".format(role_obj.mention, message), **SANITIZE_ROLES_KWARG)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user