aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Amrou Bellalouna <[email protected]>2024-05-21 04:10:14 +0200
committerGravatar GitHub <[email protected]>2024-05-21 02:10:14 +0000
commit3ef5542539180653bb4c7c7b06df002453dc8299 (patch)
treef36aec990121680ec6dabc09aa155633ae5fde93
parentBump emoji from 2.11.1 to 2.12.1 (#1534) (diff)
Cleanup constants (#1484)
-rw-r--r--bot/constants.py7
-rw-r--r--bot/exts/core/extensions.py4
-rw-r--r--bot/exts/fun/battleship.py9
-rw-r--r--bot/exts/fun/snakes/_utils.py16
4 files changed, 14 insertions, 22 deletions
diff --git a/bot/constants.py b/bot/constants.py
index 3be4a1cf..3d24ac1e 100644
--- a/bot/constants.py
+++ b/bot/constants.py
@@ -50,12 +50,9 @@ class _Channels(EnvConfig, env_prefix="channels_"):
algos_and_data_structs: int = 650401909852864553
bot_commands: int = 267659945086812160
community_meta: int = 267659945086812160
- organisation: int = 551789653284356126
data_science_and_ai: int = 366673247892275221
devlog: int = 622895325144940554
dev_contrib: int = 635950537262759947
- mod_meta: int = 775412552795947058
- mod_tools: int = 775413915391098921
off_topic_0: int = 291284109232308226
off_topic_1: int = 463035241142026251
off_topic_2: int = 463035268514185226
@@ -63,7 +60,6 @@ class _Channels(EnvConfig, env_prefix="channels_"):
sir_lancebot_playground: int = 607247579608121354
voice_chat_0: int = 412357430186344448
voice_chat_1: int = 799647045886541885
- staff_voice: int = 541638762007101470
reddit: int = 458224812528238616
@@ -73,9 +69,7 @@ Channels = _Channels()
class _Categories(EnvConfig, env_prefix="categories_"):
python_help_system: int = 691405807388196926
development: int = 411199786025484308
- devprojects: int = 787641585624940544
media: int = 799054581991997460
- staff: int = 364918151625965579
Categories = _Categories()
@@ -147,7 +141,6 @@ class Emojis:
cross_mark = "\u274C"
check = "\u2611"
- envelope = "\U0001F4E8"
trashcan = environ.get(
"TRASHCAN_EMOJI",
diff --git a/bot/exts/core/extensions.py b/bot/exts/core/extensions.py
index cfba58c8..24a28e2b 100644
--- a/bot/exts/core/extensions.py
+++ b/bot/exts/core/extensions.py
@@ -207,7 +207,7 @@ class Extensions(commands.Cog):
if error:
failures[extension] = error
- emoji = ":x:" if failures else ":ok_hand:"
+ emoji = ":x:" if failures else Emojis.ok_hand
msg = f"{emoji} {len(extensions) - len(failures)} / {len(extensions)} extensions {verb}ed."
if failures:
@@ -241,7 +241,7 @@ class Extensions(commands.Cog):
error_msg = f"{e.__class__.__name__}: {e}"
msg = f":x: Failed to {verb} extension `{ext}`:\n```\n{error_msg}\n```"
else:
- msg = f":ok_hand: Extension successfully {verb}ed: `{ext}`."
+ msg = f"{Emojis.ok_hand} Extension successfully {verb}ed: `{ext}`."
log.debug(msg[10:])
return msg, error_msg
diff --git a/bot/exts/fun/battleship.py b/bot/exts/fun/battleship.py
index d9b2b58a..f711074c 100644
--- a/bot/exts/fun/battleship.py
+++ b/bot/exts/fun/battleship.py
@@ -8,7 +8,7 @@ from discord.ext import commands
from pydis_core.utils.logging import get_logger
from bot.bot import Bot
-from bot.constants import Colours
+from bot.constants import Colours, Emojis
log = get_logger(__name__)
@@ -86,7 +86,6 @@ NUMBERS = [
]
CROSS_EMOJI = "\u274e"
-HAND_RAISED_EMOJI = "\U0001f64b"
class Game:
@@ -338,7 +337,7 @@ class Battleship(commands.Cog):
return True # Is dealt with later on
if (
user.id not in (ctx.me.id, ctx.author.id)
- and str(reaction.emoji) == HAND_RAISED_EMOJI
+ and str(reaction.emoji) == Emojis.hand_raised
and reaction.message.id == announcement.id
):
if self.already_playing(user):
@@ -384,11 +383,11 @@ class Battleship(commands.Cog):
announcement = await ctx.send(
"**Battleship**: A new game is about to start!\n"
- f"Press {HAND_RAISED_EMOJI} to play against {ctx.author.mention}!\n"
+ f"Press {Emojis.hand_raised} to play against {ctx.author.mention}!\n"
f"(Cancel the game with {CROSS_EMOJI}.)"
)
self.waiting.append(ctx.author)
- await announcement.add_reaction(HAND_RAISED_EMOJI)
+ await announcement.add_reaction(Emojis.hand_raised)
await announcement.add_reaction(CROSS_EMOJI)
try:
diff --git a/bot/exts/fun/snakes/_utils.py b/bot/exts/fun/snakes/_utils.py
index 8d24a6aa..77957187 100644
--- a/bot/exts/fun/snakes/_utils.py
+++ b/bot/exts/fun/snakes/_utils.py
@@ -11,7 +11,7 @@ from discord import File, Member, Reaction, User
from discord.ext.commands import Cog, Context
from pydis_core.utils.logging import get_logger
-from bot.constants import MODERATION_ROLES
+from bot.constants import Emojis, MODERATION_ROLES
SNAKE_RESOURCES = Path("bot/resources/fun/snakes").absolute()
@@ -355,17 +355,17 @@ def frame_to_png_bytes(image: Image) -> io.BytesIO:
log = get_logger(__name__)
-START_EMOJI = "\u2611" # :ballot_box_with_check: - Start the game
-CANCEL_EMOJI = "\u274C" # :x: - Cancel or leave the game
-ROLL_EMOJI = "\U0001F3B2" # :game_die: - Roll the die!
-JOIN_EMOJI = "\U0001F64B" # :raising_hand: - Join the game.
+START_EMOJI = Emojis.check
+CANCEL_EMOJI = Emojis.cross_mark
+DICE_ROLL_EMOJI = "\U0001F3B2"
+JOIN_EMOJI = "\U0001F64B"
STARTUP_SCREEN_EMOJI = [
JOIN_EMOJI,
START_EMOJI,
CANCEL_EMOJI
]
GAME_SCREEN_EMOJI = [
- ROLL_EMOJI,
+ DICE_ROLL_EMOJI,
CANCEL_EMOJI
]
@@ -585,7 +585,7 @@ class SnakeAndLaddersGame:
file=board_file
)
temp_positions = await self.channel.send(
- f"**Current positions**:\n{player_list}\n\nUse {ROLL_EMOJI} to roll the dice!"
+ f"**Current positions**:\n{player_list}\n\nUse {DICE_ROLL_EMOJI} to roll the dice!"
)
# Delete the previous messages
@@ -615,7 +615,7 @@ class SnakeAndLaddersGame:
check=game_event_check
)
- if reaction.emoji == ROLL_EMOJI:
+ if reaction.emoji == DICE_ROLL_EMOJI:
await self.player_roll(user)
elif reaction.emoji == CANCEL_EMOJI:
if self._is_moderator(user) and user not in self.players: