Skip to content

Commit

Permalink
allows up to 10 choices
Browse files Browse the repository at this point in the history
and fix a bug when we tried to add more than 7 choices
  • Loading branch information
AiroPi committed Mar 23, 2024
1 parent c7d0f21 commit 8b2c6de
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 2 deletions.
2 changes: 1 addition & 1 deletion compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ services:
target: production
develop:
watch:
- action: sync
- action: sync+restart
path: ./src
target: /app
- action: rebuild
Expand Down
5 changes: 4 additions & 1 deletion src/cogs/poll/constants.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from core import Emojis

COLORS_ORDER = ["blue", "red", "yellow", "purple", "brown", "green", "orange"]
COLORS_ORDER = ["blue", "red", "yellow", "purple", "brown", "green", "orange", "pink", "lime", "blue_green"]
COLOR_TO_HEX = {
"blue": 0x54ACEE,
"red": 0xDD2D44,
Expand All @@ -9,6 +9,9 @@
"brown": 0xC1694F,
"green": 0x78B159,
"orange": 0xF4900E,
"pink": 0xFFB7CE,
"lime": 0xBEFD73,
"blue_green": 0x9ADEDB,
}
LEGEND_EMOJIS = [getattr(Emojis, f"{color}_round") for color in COLORS_ORDER]
GRAPH_EMOJIS = [getattr(Emojis, f"{color}_mid") for color in COLORS_ORDER]
Expand Down
1 change: 1 addition & 0 deletions src/cogs/poll/edit.py
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,7 @@ async def cancel(self):

async def update(self):
self.remove_choice.disabled = len(self.poll.choices) <= 2
self.add_choice.disabled = len(self.poll.choices) >= 10

@ui.button(row=0, style=discord.ButtonStyle.blurple)
async def add_choice(self, inter: discord.Interaction, button: ui.Button[Self]):
Expand Down
15 changes: 15 additions & 0 deletions src/core/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,21 @@ class Emojis:
orange_left = Emoji(1077941871009091594)
orange_right = Emoji(1077960256317042759)

lime_round = Emoji(1221172679990710424)
lime_mid = Emoji(1221172685120208957)
lime_left = Emoji(1221172690375938148)
lime_right = Emoji(1221173222842826905)

blue_green_round = Emoji(1221172678686412931)
blue_green_mid = Emoji(1221172683434229891)
blue_green_left = Emoji(1221172689117380708)
blue_green_right = Emoji(1221172692871282798)

pink_round = Emoji(1221172697351065721)
pink_mid = Emoji(1221172682012364951)
pink_left = Emoji(1221172687062306846)
pink_right = Emoji(1221172691244154971)

thumb_up = "👍"
thumb_down = "👎"

Expand Down

0 comments on commit 8b2c6de

Please sign in to comment.