|
@ -43,7 +43,7 @@ from typing import ( |
|
|
) |
|
|
) |
|
|
|
|
|
|
|
|
from .item import Item, ItemCallbackType |
|
|
from .item import Item, ItemCallbackType |
|
|
from .button import Button |
|
|
from .button import Button, button as _button |
|
|
from .dynamic import DynamicItem |
|
|
from .dynamic import DynamicItem |
|
|
from .select import select as _select, Select, UserSelect, RoleSelect, ChannelSelect, MentionableSelect |
|
|
from .select import select as _select, Select, UserSelect, RoleSelect, ChannelSelect, MentionableSelect |
|
|
from ..components import ActionRow as ActionRowComponent |
|
|
from ..components import ActionRow as ActionRowComponent |
|
@ -281,22 +281,16 @@ class ActionRow(Item[V]): |
|
|
""" |
|
|
""" |
|
|
|
|
|
|
|
|
def decorator(func: ItemCallbackType[V, Button[V]]) -> ItemCallbackType[V, Button[V]]: |
|
|
def decorator(func: ItemCallbackType[V, Button[V]]) -> ItemCallbackType[V, Button[V]]: |
|
|
if not inspect.iscoroutinefunction(func): |
|
|
ret = _button( |
|
|
raise TypeError('button function must be a coroutine function') |
|
|
label=label, |
|
|
|
|
|
custom_id=custom_id, |
|
|
func.__discord_ui_parent__ = self |
|
|
disabled=disabled, |
|
|
func.__discord_ui_modal_type__ = Button |
|
|
style=style, |
|
|
func.__discord_ui_model_kwargs__ = { |
|
|
emoji=emoji, |
|
|
'style': style, |
|
|
row=None, |
|
|
'custom_id': custom_id, |
|
|
)(func) |
|
|
'url': None, |
|
|
ret.__discord_ui_parent__ = self # type: ignore |
|
|
'disabled': disabled, |
|
|
return ret # type: ignore |
|
|
'label': label, |
|
|
|
|
|
'emoji': emoji, |
|
|
|
|
|
'row': None, |
|
|
|
|
|
'sku_id': None, |
|
|
|
|
|
} |
|
|
|
|
|
return func |
|
|
|
|
|
|
|
|
|
|
|
return decorator # type: ignore |
|
|
return decorator # type: ignore |
|
|
|
|
|
|
|
|