From 3d37331cbaac332112ff5e1a654e0b607465a895 Mon Sep 17 00:00:00 2001 From: DA344 <108473820+DA-344@users.noreply.github.com> Date: Tue, 20 May 2025 23:20:44 +0200 Subject: [PATCH 1/5] chore: Co-authored-by: Soheab <33902984+Soheab@users.noreply.github.com> --- discord/ui/container.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/discord/ui/container.py b/discord/ui/container.py index c74104237..8f6d425d1 100644 --- a/discord/ui/container.py +++ b/discord/ui/container.py @@ -81,9 +81,6 @@ class Container(Item[V]): This can be inherited. - .. note:: - - Containers can contain up to 10 top-level components. .. versionadded:: 2.6 From fe3b5963793e76cce94a0706e85738c2ac68e287 Mon Sep 17 00:00:00 2001 From: DA344 <108473820+DA-344@users.noreply.github.com> Date: Tue, 20 May 2025 23:21:40 +0200 Subject: [PATCH 2/5] fix: unexpected behaviour on accent_colours Co-authored-by: Soheab <33902984+Soheab@users.noreply.github.com> --- discord/ui/container.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/discord/ui/container.py b/discord/ui/container.py index 8f6d425d1..ed1ba80b0 100644 --- a/discord/ui/container.py +++ b/discord/ui/container.py @@ -151,7 +151,7 @@ class Container(Item[V]): self.add_item(child) self.spoiler: bool = spoiler - self._colour = accent_colour or accent_color + self._colour = accent_colour if accent_colour is not None else accent_color self.row = row self.id = id From cf21c5bf80ba238fc768cb923b4ef5a854a5783f Mon Sep 17 00:00:00 2001 From: DA344 <108473820+DA-344@users.noreply.github.com> Date: Tue, 20 May 2025 23:23:56 +0200 Subject: [PATCH 3/5] chore: revert double quotes to single quotes --- discord/types/components.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/discord/types/components.py b/discord/types/components.py index a458a1d96..332701ef5 100644 --- a/discord/types/components.py +++ b/discord/types/components.py @@ -33,7 +33,7 @@ from .channel import ChannelType ComponentType = Literal[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 17] ButtonStyle = Literal[1, 2, 3, 4, 5, 6] TextStyle = Literal[1, 2] -DefaultValueType = Literal["user", "role", "channel"] +DefaultValueType = Literal['user', 'role', 'channel'] SeparatorSize = Literal[1, 2] MediaItemLoadingState = Literal[0, 1, 2, 3] From 0a8d9cbf02499ce05346e2fdd39e73674ec69a7c Mon Sep 17 00:00:00 2001 From: DA344 <108473820+DA-344@users.noreply.github.com> Date: Tue, 20 May 2025 23:29:25 +0200 Subject: [PATCH 4/5] chore: check types on Container.accent_colour setter --- discord/ui/container.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/discord/ui/container.py b/discord/ui/container.py index ed1ba80b0..cfce5ef2f 100644 --- a/discord/ui/container.py +++ b/discord/ui/container.py @@ -247,6 +247,9 @@ class Container(Item[V]): @accent_colour.setter def accent_colour(self, value: Optional[Union[Colour, int]]) -> None: + if not isinstance(value, (int, Colour)): + raise TypeError(f'expected an int, or Colour, not {value.__class__.__name__!r}') + self._colour = value accent_color = accent_colour From f0c0e40ba981a06375f7e66c310e997c82845a67 Mon Sep 17 00:00:00 2001 From: DA344 <108473820+DA-344@users.noreply.github.com> Date: Wed, 21 May 2025 13:03:20 +0200 Subject: [PATCH 5/5] fix: Colo(u)r being on TYPE_CHECKING block --- discord/ui/container.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/discord/ui/container.py b/discord/ui/container.py index cfce5ef2f..77dee7fa4 100644 --- a/discord/ui/container.py +++ b/discord/ui/container.py @@ -47,11 +47,11 @@ from .view import _component_to_item, LayoutView from .dynamic import DynamicItem from ..enums import ComponentType from ..utils import MISSING, get as _utils_get +from ..colour import Colour, Color if TYPE_CHECKING: from typing_extensions import Self - from ..colour import Colour, Color from ..components import Container as ContainerComponent from ..interactions import Interaction