mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-08-28 14:05:05 +00:00
Allow TextDisplay as a top-level component in modals
This commit is contained in:
parent
0b7d30bbe3
commit
de09031899
@ -35,6 +35,7 @@ from .._types import ClientT
|
|||||||
from .item import Item
|
from .item import Item
|
||||||
from .view import View
|
from .view import View
|
||||||
from .label import Label
|
from .label import Label
|
||||||
|
from .text_display import TextDisplay
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from typing_extensions import Self
|
from typing_extensions import Self
|
||||||
@ -204,7 +205,7 @@ class Modal(View):
|
|||||||
children = sorted(self._children, key=key)
|
children = sorted(self._children, key=key)
|
||||||
components: List[Dict[str, Any]] = []
|
components: List[Dict[str, Any]] = []
|
||||||
for child in children:
|
for child in children:
|
||||||
if isinstance(child, Label):
|
if isinstance(child, (Label, TextDisplay)):
|
||||||
components.append(child.to_component_dict()) # type: ignore
|
components.append(child.to_component_dict()) # type: ignore
|
||||||
else:
|
else:
|
||||||
# Every implicit child wrapped in an ActionRow in a modal
|
# Every implicit child wrapped in an ActionRow in a modal
|
||||||
|
Loading…
x
Reference in New Issue
Block a user