aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar S. Co1 <[email protected]>2020-03-31 14:11:05 -0400
committerGravatar GitHub <[email protected]>2020-03-31 14:11:05 -0400
commit9eeb4fa94e6af755c2328d83c54a59c01b8ad3eb (patch)
treee0effdbdc479fb48a832a6dbdc646d5043743ef7
parentMerge pull request #846 from python-discord/feat/filter/322/merge-tokens-words (diff)
parentMerge branch 'master' into tags-trashcan-react (diff)
Merge pull request #854 from ks129/tags-trashcan-react
Tags response + command message deletion with trashcan reaction
Diffstat (limited to '')
-rw-r--r--bot/cogs/tags.py22
1 files changed, 17 insertions, 5 deletions
diff --git a/bot/cogs/tags.py b/bot/cogs/tags.py
index 539105017..a6e5952ff 100644
--- a/bot/cogs/tags.py
+++ b/bot/cogs/tags.py
@@ -11,6 +11,7 @@ from bot import constants
from bot.bot import Bot
from bot.converters import TagNameConverter
from bot.pagination import LinePaginator
+from bot.utils.messages import wait_for_deletion
log = logging.getLogger(__name__)
@@ -167,6 +168,7 @@ class Tags(Cog):
@tags_group.command(name='get', aliases=('show', 'g'))
async def get_command(self, ctx: Context, *, tag_name: TagNameConverter = None) -> None:
"""Get a specified tag, or a list of all tags if no tag is specified."""
+
def _command_on_cooldown(tag_name: str) -> bool:
"""
Check if the command is currently on cooldown, on a per-tag, per-channel basis.
@@ -205,12 +207,22 @@ class Tags(Cog):
"time": time.time(),
"channel": ctx.channel.id
}
- await ctx.send(embed=Embed.from_dict(tag['embed']))
+ await wait_for_deletion(
+ await ctx.send(embed=Embed.from_dict(tag['embed'])),
+ [ctx.author.id],
+ client=self.bot
+ )
elif founds and len(tag_name) >= 3:
- await ctx.send(embed=Embed(
- title='Did you mean ...',
- description='\n'.join(tag['title'] for tag in founds[:10])
- ))
+ await wait_for_deletion(
+ await ctx.send(
+ embed=Embed(
+ title='Did you mean ...',
+ description='\n'.join(tag['title'] for tag in founds[:10])
+ )
+ ),
+ [ctx.author.id],
+ client=self.bot
+ )
else:
tags = self._cache.values()