aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bot/cogs/help.py13
-rw-r--r--bot/utils/messages.py8
-rw-r--r--config-default.yml2
3 files changed, 13 insertions, 10 deletions
diff --git a/bot/cogs/help.py b/bot/cogs/help.py
index 9607dbd8d..63b4e89b8 100644
--- a/bot/cogs/help.py
+++ b/bot/cogs/help.py
@@ -10,20 +10,22 @@ from discord.ext.commands import Bot, CheckFailure, Cog as DiscordCog, Command,
from fuzzywuzzy import fuzz, process
from bot import constants
-from bot.constants import Channels, STAFF_ROLES
+from bot.constants import Channels, Emojis, STAFF_ROLES
from bot.decorators import redirect_output
from bot.pagination import (
- DELETE_EMOJI, FIRST_EMOJI, LAST_EMOJI,
+ DELETE_EMOJI as CLEAR_EMOJI, FIRST_EMOJI, LAST_EMOJI,
LEFT_EMOJI, LinePaginator, RIGHT_EMOJI,
)
+DELETE_EMOJI = Emojis.trashcan
REACTIONS = {
FIRST_EMOJI: 'first',
LEFT_EMOJI: 'back',
RIGHT_EMOJI: 'next',
LAST_EMOJI: 'end',
- DELETE_EMOJI: 'stop'
+ CLEAR_EMOJI: 'clear',
+ DELETE_EMOJI: 'stop',
}
Cog = namedtuple('Cog', ['name', 'description', 'commands'])
@@ -496,6 +498,11 @@ class HelpSession:
if not self.is_last_page:
await self.update_page(len(self._pages)-1)
+ async def do_clear(self) -> None:
+ """Event that is called when the user clears the emojis from the pagination."""
+ await self.message.clear_reactions()
+ await self.message.add_reaction(DELETE_EMOJI)
+
async def do_stop(self) -> None:
"""Event that is called when the user requests to stop the help session."""
await self.message.delete()
diff --git a/bot/utils/messages.py b/bot/utils/messages.py
index fe0b6b29f..654d71797 100644
--- a/bot/utils/messages.py
+++ b/bot/utils/messages.py
@@ -15,7 +15,7 @@ MAX_SIZE = 1024 * 1024 * 8 # 8 Mebibytes
async def wait_for_deletion(
message: Message,
user_ids: Sequence[Snowflake],
- deletion_emojis: Sequence[str] = None,
+ deletion_emojis: Sequence[str] = (Emojis.trashcan,),
timeout: float = 60 * 5,
attach_emojis: bool = True,
client: Optional[Client] = None
@@ -34,10 +34,6 @@ async def wait_for_deletion(
bot = client or message.guild.me
- if deletion_emojis is None:
- default_emoji = bot.get_emoji(int(Emojis.trashcan)) or Emojis.cross_mark
- deletion_emojis = (default_emoji,)
-
if attach_emojis:
for emoji in deletion_emojis:
await message.add_reaction(emoji)
@@ -46,7 +42,7 @@ async def wait_for_deletion(
"""Check that the deletion emoji is reacted by the approprite user."""
return (
reaction.message.id == message.id
- and reaction.emoji in deletion_emojis
+ and str(reaction.emoji) in deletion_emojis
and user.id in user_ids
)
diff --git a/config-default.yml b/config-default.yml
index 16842534d..696ef8a7e 100644
--- a/config-default.yml
+++ b/config-default.yml
@@ -32,7 +32,7 @@ style:
status_dnd: "<:status_dnd:470326272082313216>"
status_offline: "<:status_offline:470326266537705472>"
- trashcan: "637136429717389331"
+ trashcan: "<:trashcan:637136429717389331>"
bullet: "\u2022"
pencil: "\u270F"