aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bot/cogs/help.py7
-rw-r--r--bot/constants.py1
-rw-r--r--bot/pagination.py18
-rw-r--r--bot/utils/messages.py6
-rw-r--r--config-default.yml1
5 files changed, 19 insertions, 14 deletions
diff --git a/bot/cogs/help.py b/bot/cogs/help.py
index 6385fa467..fd5bbc3ca 100644
--- a/bot/cogs/help.py
+++ b/bot/cogs/help.py
@@ -11,20 +11,21 @@ from fuzzywuzzy import fuzz, process
from bot import constants
from bot.bot import Bot
-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,
+ 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'
+ DELETE_EMOJI: 'stop',
}
Cog = namedtuple('Cog', ['name', 'description', 'commands'])
diff --git a/bot/constants.py b/bot/constants.py
index 629985bdf..fe8e57322 100644
--- a/bot/constants.py
+++ b/bot/constants.py
@@ -257,6 +257,7 @@ class Emojis(metaclass=YAMLGetter):
status_dnd: str
failmail: str
+ trashcan: str
bullet: str
new: str
diff --git a/bot/pagination.py b/bot/pagination.py
index 76082f459..35870c040 100644
--- a/bot/pagination.py
+++ b/bot/pagination.py
@@ -6,11 +6,13 @@ from discord import Embed, Member, Message, Reaction
from discord.abc import User
from discord.ext.commands import Context, Paginator
+from bot import constants
+
FIRST_EMOJI = "\u23EE" # [:track_previous:]
LEFT_EMOJI = "\u2B05" # [:arrow_left:]
RIGHT_EMOJI = "\u27A1" # [:arrow_right:]
LAST_EMOJI = "\u23ED" # [:track_next:]
-DELETE_EMOJI = "\u274c" # [:x:]
+DELETE_EMOJI = constants.Emojis.trashcan # [:trashcan:]
PAGINATION_EMOJI = [FIRST_EMOJI, LEFT_EMOJI, RIGHT_EMOJI, LAST_EMOJI, DELETE_EMOJI]
@@ -131,7 +133,7 @@ class LinePaginator(Paginator):
# Reaction is on this message
reaction_.message.id == message.id,
# Reaction is one of the pagination emotes
- reaction_.emoji in PAGINATION_EMOJI,
+ str(reaction_.emoji) in PAGINATION_EMOJI,
# Reaction was not made by the Bot
user_.id != ctx.bot.user.id,
# There were no restrictions
@@ -203,9 +205,9 @@ class LinePaginator(Paginator):
log.debug("Timed out waiting for a reaction")
break # We're done, no reactions for the last 5 minutes
- if reaction.emoji == DELETE_EMOJI:
+ if str(reaction.emoji) == DELETE_EMOJI:
log.debug("Got delete reaction")
- break
+ return await message.delete()
if reaction.emoji == FIRST_EMOJI:
await message.remove_reaction(reaction.emoji, user)
@@ -342,7 +344,7 @@ class ImagePaginator(Paginator):
# Reaction is on the same message sent
reaction_.message.id == message.id,
# The reaction is part of the navigation menu
- reaction_.emoji in PAGINATION_EMOJI,
+ str(reaction_.emoji) in PAGINATION_EMOJI,
# The reactor is not a bot
not member.bot
))
@@ -388,10 +390,10 @@ class ImagePaginator(Paginator):
# Deletes the users reaction
await message.remove_reaction(reaction.emoji, user)
- # Delete reaction press - [:x:]
- if reaction.emoji == DELETE_EMOJI:
+ # Delete reaction press - [:trashcan:]
+ if str(reaction.emoji) == DELETE_EMOJI:
log.debug("Got delete reaction")
- break
+ return await message.delete()
# First reaction press - [:track_previous:]
if reaction.emoji == FIRST_EMOJI:
diff --git a/bot/utils/messages.py b/bot/utils/messages.py
index c4e2753e0..a36edc774 100644
--- a/bot/utils/messages.py
+++ b/bot/utils/messages.py
@@ -16,7 +16,7 @@ log = logging.getLogger(__name__)
async def wait_for_deletion(
message: Message,
user_ids: Sequence[Snowflake],
- deletion_emojis: Sequence[str] = (Emojis.cross_mark,),
+ deletion_emojis: Sequence[str] = (Emojis.trashcan,),
timeout: float = 60 * 5,
attach_emojis: bool = True,
client: Optional[Client] = None
@@ -40,10 +40,10 @@ async def wait_for_deletion(
await message.add_reaction(emoji)
def check(reaction: Reaction, user: Member) -> bool:
- """Check that the deletion emoji is reacted by the approprite user."""
+ """Check that the deletion emoji is reacted by the appropriate 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 c113d3330..fda14b511 100644
--- a/config-default.yml
+++ b/config-default.yml
@@ -28,6 +28,7 @@ style:
status_offline: "<:status_offline:470326266537705472>"
failmail: "<:failmail:633660039931887616>"
+ trashcan: "<:trashcan:637136429717389331>"
bullet: "\u2022"
pencil: "\u270F"