|
|
@ -304,8 +304,6 @@ class Command(Generic[GroupT, P, T]): |
|
|
|
------------ |
|
|
|
name: :class:`str` |
|
|
|
The name of the application command. |
|
|
|
callback: :ref:`coroutine <coroutine>` |
|
|
|
The coroutine that is executed when the command is called. |
|
|
|
description: :class:`str` |
|
|
|
The description of the application command. This shows up in the UI to describe |
|
|
|
the application command. |
|
|
@ -329,6 +327,11 @@ class Command(Generic[GroupT, P, T]): |
|
|
|
self.on_error: Optional[Error[GroupT]] = None |
|
|
|
self._params: Dict[str, CommandParameter] = _extract_parameters_from_callback(callback, callback.__globals__) |
|
|
|
|
|
|
|
@property |
|
|
|
def callback(self) -> CommandCallback[GroupT, P, T]: |
|
|
|
""":ref:`coroutine <coroutine>`: The coroutine that is executed when the command is called.""" |
|
|
|
return self._callback |
|
|
|
|
|
|
|
def _copy_with_binding(self, binding: GroupT) -> Command: |
|
|
|
cls = self.__class__ |
|
|
|
copy = cls.__new__(cls) |
|
|
@ -542,8 +545,6 @@ class ContextMenu: |
|
|
|
------------ |
|
|
|
name: :class:`str` |
|
|
|
The name of the context menu. |
|
|
|
callback: :ref:`coroutine <coroutine>` |
|
|
|
The coroutine that is executed when the context menu is called. |
|
|
|
type: :class:`.AppCommandType` |
|
|
|
The type of context menu application command. |
|
|
|
""" |
|
|
@ -564,6 +565,11 @@ class ContextMenu: |
|
|
|
self._param_name = param |
|
|
|
self._annotation = annotation |
|
|
|
|
|
|
|
@property |
|
|
|
def callback(self) -> ContextMenuCallback: |
|
|
|
""":ref:`coroutine <coroutine>`: The coroutine that is executed when the context menu is called.""" |
|
|
|
return self._callback |
|
|
|
|
|
|
|
@classmethod |
|
|
|
def _from_decorator(cls, callback: ContextMenuCallback, *, name: str = MISSING) -> ContextMenu: |
|
|
|
(param, annotation, type) = _get_context_menu_parameter(callback) |
|
|
|