Skip to content

Commit

Permalink
countryballs: handle alternative quotes (Ballsdex-Team#549)
Browse files Browse the repository at this point in the history
* Use Python 3.13 because of admin panel

Python 3.13 is required but pyproject.toml only requires python 3.12

* poetry lock

* remove fancy quotes when submit name

* add space after comma aughhh

gsregregresgreg

---------

Co-authored-by: A <[email protected]>
Co-authored-by: Auguste Charpentier <[email protected]>
  • Loading branch information
3 people authored Feb 19, 2025
1 parent 70711ce commit 7806d48
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions ballsdex/packages/countryballs/components.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,14 @@ async def on_submit(self, interaction: discord.Interaction["BallsDexBot"]):
possible_names = (self.ball.name.lower(),)
if self.ball.model.translations:
possible_names += tuple(x.lower() for x in self.ball.model.translations.split(";"))

if self.name.value.lower().strip() in possible_names:
cname = self.name.value.lower().strip()
# Remove fancy unicode characters like ’ to replace to '
cname = cname.replace("\u2019", "'")
cname = cname.replace("\u2018", "'")
cname = cname.replace("\u201C", '"')
cname = cname.replace("\u201D", '"')
# There are other "fancy" quotes as well but these are most common
if cname in possible_names:
self.ball.caught = True
ball, has_caught_before = await self.catch_ball(
interaction.client, cast(discord.Member, interaction.user)
Expand Down

0 comments on commit 7806d48

Please sign in to comment.