Skip to content

Commit

Permalink
bugfix with emojis
Browse files Browse the repository at this point in the history
Signed-off-by: robertsokola <[email protected]>
  • Loading branch information
TheXer committed Sep 3, 2023
1 parent 578a93b commit 2af07a6
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/ui/modals.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,19 +40,22 @@ async def add_item_to_embed(self) -> PollEmbed:
"value": "**0** | ",
"inline": False,
}
date_field = len(self.embed.fields) - 1

# Lmao, not ideal, but it is what it is.
if self.embed.fields[len(self.embed.fields) - 1].value.startswith("Anketa vyprší"):
index = len(self.embed.fields) - 1
if self.embed.fields[date_field].value.startswith("Anketa vyprší"):
index = date_field
emoji = date_field
else:
index = len(self.embed.fields)
emoji = len(self.embed.fields)

options["index"] = index

self.view.add_item(
ButtonBackend(
label=self.new_option.value,
emoji=NUMBER_EMOJIS[len(self.embed.fields)],
emoji=NUMBER_EMOJIS[emoji],
index=index,
poll=self.poll,
custom_id=f"{len(self.embed.fields)}:{self.poll.message_id}",
Expand Down

0 comments on commit 2af07a6

Please sign in to comment.