From 8b2c6de19da54e27fb9223e2f6b889ba84f968d6 Mon Sep 17 00:00:00 2001 From: "airo.pi_" <47398145+AiroPi@users.noreply.github.com> Date: Sat, 23 Mar 2024 20:32:22 +0100 Subject: [PATCH] allows up to 10 choices and fix a bug when we tried to add more than 7 choices --- compose.yml | 2 +- src/cogs/poll/constants.py | 5 ++++- src/cogs/poll/edit.py | 1 + src/core/constants.py | 15 +++++++++++++++ 4 files changed, 21 insertions(+), 2 deletions(-) diff --git a/compose.yml b/compose.yml index 376b3b3..7024a86 100644 --- a/compose.yml +++ b/compose.yml @@ -8,7 +8,7 @@ services: target: production develop: watch: - - action: sync + - action: sync+restart path: ./src target: /app - action: rebuild diff --git a/src/cogs/poll/constants.py b/src/cogs/poll/constants.py index e8cea1f..f43d869 100644 --- a/src/cogs/poll/constants.py +++ b/src/cogs/poll/constants.py @@ -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, @@ -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] diff --git a/src/cogs/poll/edit.py b/src/cogs/poll/edit.py index a6de03b..0fa18c1 100644 --- a/src/cogs/poll/edit.py +++ b/src/cogs/poll/edit.py @@ -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]): diff --git a/src/core/constants.py b/src/core/constants.py index 9b58844..ab32d59 100644 --- a/src/core/constants.py +++ b/src/core/constants.py @@ -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 = "👎"