mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-07-11 12:28:03 +00:00
Fix View.from_message not creating other Selects
This commit is contained in:
parent
3827671bf7
commit
e67d00502d
@ -235,6 +235,7 @@ class BaseSelect(Item[V]):
|
|||||||
def from_component(cls, component: SelectMenu) -> Self:
|
def from_component(cls, component: SelectMenu) -> Self:
|
||||||
return cls(
|
return cls(
|
||||||
**{k: getattr(component, k) for k in cls.__item_repr_attributes__},
|
**{k: getattr(component, k) for k in cls.__item_repr_attributes__},
|
||||||
|
custom_id=component.custom_id,
|
||||||
row=None,
|
row=None,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -34,6 +34,7 @@ import time
|
|||||||
import os
|
import os
|
||||||
from .item import Item, ItemCallbackType
|
from .item import Item, ItemCallbackType
|
||||||
from .dynamic import DynamicItem
|
from .dynamic import DynamicItem
|
||||||
|
from ..enums import ComponentType
|
||||||
from ..components import (
|
from ..components import (
|
||||||
Component,
|
Component,
|
||||||
ActionRow as ActionRowComponent,
|
ActionRow as ActionRowComponent,
|
||||||
@ -78,9 +79,26 @@ def _component_to_item(component: Component) -> Item:
|
|||||||
|
|
||||||
return Button.from_component(component)
|
return Button.from_component(component)
|
||||||
if isinstance(component, SelectComponent):
|
if isinstance(component, SelectComponent):
|
||||||
|
if component.type is ComponentType.select:
|
||||||
from .select import Select
|
from .select import Select
|
||||||
|
|
||||||
return Select.from_component(component)
|
return Select.from_component(component)
|
||||||
|
elif component.type is ComponentType.user_select:
|
||||||
|
from .select import UserSelect
|
||||||
|
|
||||||
|
return UserSelect.from_component(component)
|
||||||
|
elif component.type is ComponentType.mentionable_select:
|
||||||
|
from .select import MentionableSelect
|
||||||
|
|
||||||
|
return MentionableSelect.from_component(component)
|
||||||
|
elif component.type is ComponentType.channel_select:
|
||||||
|
from .select import ChannelSelect
|
||||||
|
|
||||||
|
return ChannelSelect().from_component(component)
|
||||||
|
elif component.type is ComponentType.role_select:
|
||||||
|
from .select import RoleSelect
|
||||||
|
|
||||||
|
return RoleSelect.from_component(component)
|
||||||
return Item.from_component(component)
|
return Item.from_component(component)
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user