Skip to content

Commit

Permalink
remove custom emoji handling
Browse files Browse the repository at this point in the history
  • Loading branch information
laggron42 committed Feb 26, 2025
1 parent 6bf899f commit 26ad480
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 29 deletions.
5 changes: 1 addition & 4 deletions ballsdex/core/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -324,10 +324,7 @@ def description(
"You need to provide the bot argument when using with include_emoji=True"
)
if isinstance(self.countryball, Ball):
if "emoji" in self.countryball.capacity_logic:
emoji = self.countryball.capacity_logic["emoji"]
else:
emoji = bot.get_emoji(self.countryball.emoji_id)
emoji = bot.get_emoji(self.countryball.emoji_id)
if emoji:
if self.extra_data.get("card"):
text = f"{emoji} 🖼️ {text} "
Expand Down
20 changes: 4 additions & 16 deletions ballsdex/packages/balls/cog.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,20 +258,14 @@ async def completion(
return
# Filter disabled balls, they do not count towards progression
# Only ID and emoji is interesting for us
if self.bot.cluster_count > 1:
bot_countryballs = {
x: y.capacity_logic["emoji"] for x, y in balls.items() if y.enabled
}
else:
bot_countryballs = {x: y.emoji_id for x, y in balls.items() if y.enabled}
bot_countryballs = {x: y.emoji_id for x, y in balls.items() if y.enabled}

# Set of ball IDs owned by the player
filters = {"player__discord_id": user_obj.id, "ball__enabled": True}
if special:
filters["special"] = special
filters["ball__created_at__lt"] = special.end_date
bot_countryballs = {
x: y.capacity_logic["emoji"] if self.bot.cluster_count > 1 else y.emoji_id
x: y.emoji_id
for x, y in balls.items()
if y.enabled and (special.end_date is None or y.created_at < special.end_date)
}
Expand Down Expand Up @@ -485,10 +479,7 @@ async def favorite(

countryball.favorite = True # type: ignore
await countryball.save()
if self.bot.cluster_count > 1:
emoji = countryball.countryball.capacity_logic["emoji"]
else:
emoji = self.bot.get_emoji(countryball.countryball.emoji_id) or ""
emoji = self.bot.get_emoji(countryball.countryball.emoji_id) or ""
await interaction.response.send_message(
f"{emoji} `#{countryball.pk:0X}` {countryball.countryball.country} "
f"is now a favorite {settings.collectible_name}!",
Expand All @@ -498,10 +489,7 @@ async def favorite(
else:
countryball.favorite = False # type: ignore
await countryball.save()
if self.bot.cluster_count > 1:
emoji = countryball.countryball.capacity_logic["emoji"]
else:
emoji = self.bot.get_emoji(countryball.countryball.emoji_id) or ""
emoji = self.bot.get_emoji(countryball.countryball.emoji_id) or ""
await interaction.response.send_message(
f"{emoji} `#{countryball.pk:0X}` {countryball.countryball.country} "
f"isn't a favorite {settings.collectible_name} anymore.",
Expand Down
5 changes: 1 addition & 4 deletions ballsdex/packages/balls/countryballs_paginator.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,7 @@ def __init__(self, interaction: discord.Interaction["BallsDexBot"], balls: List[
def set_options(self, balls: List[BallInstance]):
options: List[discord.SelectOption] = []
for ball in balls:
if self.bot.cluster_count > 1:
emoji = ball.ball.capacity_logic["emoji"]
else:
emoji = self.bot.get_emoji(int(ball.countryball.emoji_id))
emoji = self.bot.get_emoji(int(ball.countryball.emoji_id))
favorite = f"{settings.favorited_collectible_emoji} " if ball.favorite else ""
special = ball.special_emoji(self.bot, True)
custom_art = "🖼️" if "card" in ball.extra_data else ""
Expand Down
7 changes: 2 additions & 5 deletions ballsdex/packages/info/cog.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,8 @@ async def _get_10_balls_emojis(self) -> list[discord.Emoji]:
emotes: list[discord.Emoji] = []

for ball in balls:
if "emoji" in ball.capacity_logic:
emotes.append(ball.capacity_logic["emoji"])
else:
if emoji := self.bot.get_emoji(ball.emoji_id):
emotes.append(emoji)
if emoji := self.bot.get_emoji(ball.emoji_id):
emotes.append(emoji)

return emotes

Expand Down

0 comments on commit 26ad480

Please sign in to comment.