mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-08-28 05:55:27 +00:00
Flip if statement for wrapped ActionRow components in modals
This commit is contained in:
parent
de09031899
commit
6d5013030b
@ -34,8 +34,8 @@ from ..utils import MISSING, find
|
|||||||
from .._types import ClientT
|
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 .select import BaseSelect
|
||||||
from .text_display import TextDisplay
|
from .text_input import TextInput
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from typing_extensions import Self
|
from typing_extensions import Self
|
||||||
@ -205,9 +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, TextDisplay)):
|
if isinstance(child, (BaseSelect, TextInput)):
|
||||||
components.append(child.to_component_dict()) # type: ignore
|
|
||||||
else:
|
|
||||||
# Every implicit child wrapped in an ActionRow in a modal
|
# Every implicit child wrapped in an ActionRow in a modal
|
||||||
# has a single child of width 5
|
# has a single child of width 5
|
||||||
# It's also deprecated to use ActionRow in modals
|
# It's also deprecated to use ActionRow in modals
|
||||||
@ -217,6 +215,8 @@ class Modal(View):
|
|||||||
'components': [child.to_component_dict()],
|
'components': [child.to_component_dict()],
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
else:
|
||||||
|
components.append(child.to_component_dict())
|
||||||
|
|
||||||
return components
|
return components
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user