aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar MarkKoz <[email protected]>2020-05-01 16:51:22 -0700
committerGravatar MarkKoz <[email protected]>2020-05-01 16:51:22 -0700
commit9c20a63e08feae35c14418820f0a6afc307ea934 (patch)
treeaf05a44645ed5f9d0de4c14e4a4d0c865ea995fa
parentMerge pull request #922 from python-discord/bug/info/914/user-animated-avatar (diff)
Remove the mention command
It was made obsolete by a new Discord feature. Users can be granted a permission to mention a role despite the role being set as non-mentionable.
-rw-r--r--bot/cogs/utils.py48
1 files changed, 2 insertions, 46 deletions
diff --git a/bot/cogs/utils.py b/bot/cogs/utils.py
index 8023eb962..89d556f58 100644
--- a/bot/cogs/utils.py
+++ b/bot/cogs/utils.py
@@ -2,19 +2,16 @@ import difflib
import logging
import re
import unicodedata
-from asyncio import TimeoutError, sleep
from email.parser import HeaderParser
from io import StringIO
from typing import Tuple, Union
-from dateutil import relativedelta
-from discord import Colour, Embed, Message, Role
+from discord import Colour, Embed
from discord.ext.commands import BadArgument, Cog, Context, command
from bot.bot import Bot
-from bot.constants import Channels, MODERATION_ROLES, Mention, STAFF_ROLES
+from bot.constants import Channels, MODERATION_ROLES, STAFF_ROLES
from bot.decorators import in_whitelist, with_role
-from bot.utils.time import humanize_delta
log = logging.getLogger(__name__)
@@ -162,47 +159,6 @@ class Utils(Cog):
await ctx.send(embed=embed)
@command()
- @with_role(*MODERATION_ROLES)
- async def mention(self, ctx: Context, *, role: Role) -> None:
- """Set a role to be mentionable for a limited time."""
- if role.mentionable:
- await ctx.send(f"{role} is already mentionable!")
- return
-
- await role.edit(reason=f"Role unlocked by {ctx.author}", mentionable=True)
-
- human_time = humanize_delta(relativedelta.relativedelta(seconds=Mention.message_timeout))
- await ctx.send(
- f"{role} has been made mentionable. I will reset it in {human_time}, or when someone mentions this role."
- )
-
- def check(m: Message) -> bool:
- """Checks that the message contains the role mention."""
- return role in m.role_mentions
-
- try:
- msg = await self.bot.wait_for("message", check=check, timeout=Mention.message_timeout)
- except TimeoutError:
- await role.edit(mentionable=False, reason="Automatic role lock - timeout.")
- await ctx.send(f"{ctx.author.mention}, you took too long. I have reset {role} to be unmentionable.")
- return
-
- if any(r.id in MODERATION_ROLES for r in msg.author.roles):
- await sleep(Mention.reset_delay)
- await role.edit(mentionable=False, reason=f"Automatic role lock by {msg.author}")
- await ctx.send(
- f"{ctx.author.mention}, I have reset {role} to be unmentionable as "
- f"{msg.author if msg.author != ctx.author else 'you'} sent a message mentioning it."
- )
- return
-
- await role.edit(mentionable=False, reason=f"Automatic role lock - unauthorised use by {msg.author}")
- await ctx.send(
- f"{ctx.author.mention}, I have reset {role} to be unmentionable "
- f"as I detected unauthorised use by {msg.author} (ID: {msg.author.id})."
- )
-
- @command()
async def zen(self, ctx: Context, *, search_value: Union[int, str, None] = None) -> None:
"""
Show the Zen of Python.