mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-09-03 08:35:53 +00:00
Add a swap method for dynamic item's dispatching
This commit is contained in:
@ -67,6 +67,7 @@ if TYPE_CHECKING:
|
||||
from ..components import SelectOption
|
||||
from ..interactions import Interaction
|
||||
from .container import Container
|
||||
from .dynamic import DynamicItem
|
||||
|
||||
SelectCallbackDecorator = Callable[[ItemCallbackType['S', BaseSelectT]], BaseSelectT]
|
||||
|
||||
@ -194,6 +195,10 @@ class ActionRow(Item[V]):
|
||||
# it should error anyways.
|
||||
return True
|
||||
|
||||
def _swap_item(self, base: Item, new: DynamicItem, custom_id: str) -> None:
|
||||
child_index = self._children.index(base)
|
||||
self._children[child_index] = new # type: ignore
|
||||
|
||||
@property
|
||||
def width(self):
|
||||
return 5
|
||||
|
Reference in New Issue
Block a user