mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-08-27 21:45: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 .item import Item
|
||||
from .view import View
|
||||
from .label import Label
|
||||
from .text_display import TextDisplay
|
||||
from .select import BaseSelect
|
||||
from .text_input import TextInput
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from typing_extensions import Self
|
||||
@ -205,9 +205,7 @@ class Modal(View):
|
||||
children = sorted(self._children, key=key)
|
||||
components: List[Dict[str, Any]] = []
|
||||
for child in children:
|
||||
if isinstance(child, (Label, TextDisplay)):
|
||||
components.append(child.to_component_dict()) # type: ignore
|
||||
else:
|
||||
if isinstance(child, (BaseSelect, TextInput)):
|
||||
# Every implicit child wrapped in an ActionRow in a modal
|
||||
# has a single child of width 5
|
||||
# It's also deprecated to use ActionRow in modals
|
||||
@ -217,6 +215,8 @@ class Modal(View):
|
||||
'components': [child.to_component_dict()],
|
||||
}
|
||||
)
|
||||
else:
|
||||
components.append(child.to_component_dict())
|
||||
|
||||
return components
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user