aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar ChrisJL <[email protected]>2021-07-23 19:52:22 +0100
committerGravatar GitHub <[email protected]>2021-07-23 19:52:22 +0100
commit56f4e4efa9dca094aea7632812e605371cf7d4fb (patch)
treed35fbd6b9851b95febba645b55fe936b19a889d4
parentMerge pull request #1693 from python-discord/Update-docstring-tag-to-have-4-s... (diff)
parentAdd comment (diff)
Merge pull request #1694 from TizzySaurus/Update-docs-get-to-prevent-ghost-pings
Prevent ghost-pings in docs get command
-rw-r--r--bot/exts/info/doc/_cog.py12
1 files changed, 8 insertions, 4 deletions
diff --git a/bot/exts/info/doc/_cog.py b/bot/exts/info/doc/_cog.py
index c54a3ee1c..704884fd1 100644
--- a/bot/exts/info/doc/_cog.py
+++ b/bot/exts/info/doc/_cog.py
@@ -14,7 +14,7 @@ import discord
from discord.ext import commands
from bot.bot import Bot
-from bot.constants import MODERATION_ROLES, RedirectOutput
+from bot.constants import Emojis, MODERATION_ROLES, RedirectOutput
from bot.converters import Inventory, PackageName, ValidURL, allowed_strings
from bot.pagination import LinePaginator
from bot.utils.lock import SharedEvent, lock
@@ -342,9 +342,13 @@ class DocCog(commands.Cog):
error_message = await send_denial(ctx, "No documentation found for the requested symbol.")
await wait_for_deletion(error_message, (ctx.author.id,), timeout=NOT_FOUND_DELETE_DELAY)
with suppress(discord.NotFound):
- await ctx.message.delete()
- with suppress(discord.NotFound):
- await error_message.delete()
+ await error_message.clear_reaction(Emojis.trashcan)
+
+ # Make sure that we won't cause a ghost-ping by deleting the message
+ if not (ctx.message.mentions or ctx.message.role_mentions):
+ with suppress(discord.NotFound):
+ await ctx.message.delete()
+
else:
msg = await ctx.send(embed=doc_embed)
await wait_for_deletion(msg, (ctx.author.id,))