mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-05-10 07:49:48 +00:00
parent
c4e09acff8
commit
6c42065210
@ -108,7 +108,7 @@ class AllChannels:
|
|||||||
|
|
||||||
|
|
||||||
class AppCommand(Hashable):
|
class AppCommand(Hashable):
|
||||||
"""Represents a application command.
|
"""Represents an application command.
|
||||||
|
|
||||||
In common parlance this is referred to as a "Slash Command" or a
|
In common parlance this is referred to as a "Slash Command" or a
|
||||||
"Context Menu Command".
|
"Context Menu Command".
|
||||||
@ -732,7 +732,7 @@ class AppCommandThread(Hashable):
|
|||||||
|
|
||||||
|
|
||||||
class Argument:
|
class Argument:
|
||||||
"""Represents a application command argument.
|
"""Represents an application command argument.
|
||||||
|
|
||||||
.. versionadded:: 2.0
|
.. versionadded:: 2.0
|
||||||
|
|
||||||
|
@ -73,7 +73,7 @@ if TYPE_CHECKING:
|
|||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
class CommandParameter:
|
class CommandParameter:
|
||||||
"""Represents a application command parameter.
|
"""Represents an application command parameter.
|
||||||
|
|
||||||
Attributes
|
Attributes
|
||||||
-----------
|
-----------
|
||||||
|
@ -344,7 +344,7 @@ class CommandTree(Generic[ClientT]):
|
|||||||
self._context_menus.update(current)
|
self._context_menus.update(current)
|
||||||
return
|
return
|
||||||
elif not isinstance(command, (Command, Group)):
|
elif not isinstance(command, (Command, Group)):
|
||||||
raise TypeError(f'Expected a application command, received {command.__class__!r} instead')
|
raise TypeError(f'Expected an application command, received {command.__class__!r} instead')
|
||||||
|
|
||||||
# todo: validate application command groups having children (required)
|
# todo: validate application command groups having children (required)
|
||||||
|
|
||||||
@ -538,7 +538,7 @@ class CommandTree(Generic[ClientT]):
|
|||||||
guild: Optional[Snowflake] = None,
|
guild: Optional[Snowflake] = None,
|
||||||
type: AppCommandType = AppCommandType.chat_input,
|
type: AppCommandType = AppCommandType.chat_input,
|
||||||
) -> Optional[Union[Command[Any, ..., Any], ContextMenu, Group]]:
|
) -> Optional[Union[Command[Any, ..., Any], ContextMenu, Group]]:
|
||||||
"""Gets a application command from the tree.
|
"""Gets an application command from the tree.
|
||||||
|
|
||||||
Parameters
|
Parameters
|
||||||
-----------
|
-----------
|
||||||
@ -900,7 +900,7 @@ class CommandTree(Generic[ClientT]):
|
|||||||
guilds: Sequence[Snowflake] = MISSING,
|
guilds: Sequence[Snowflake] = MISSING,
|
||||||
extras: Dict[Any, Any] = MISSING,
|
extras: Dict[Any, Any] = MISSING,
|
||||||
) -> Callable[[ContextMenuCallback], ContextMenu]:
|
) -> Callable[[ContextMenuCallback], ContextMenu]:
|
||||||
"""Creates a application command context menu from a regular function directly under this tree.
|
"""Creates an application command context menu from a regular function directly under this tree.
|
||||||
|
|
||||||
This function must have a signature of :class:`~discord.Interaction` as its first parameter
|
This function must have a signature of :class:`~discord.Interaction` as its first parameter
|
||||||
and taking either a :class:`~discord.Member`, :class:`~discord.User`, or :class:`~discord.Message`,
|
and taking either a :class:`~discord.Member`, :class:`~discord.User`, or :class:`~discord.Message`,
|
||||||
|
@ -406,7 +406,7 @@ class Command(_BaseCommand, Generic[CogT, P, T]):
|
|||||||
elif isinstance(cooldown, CooldownMapping):
|
elif isinstance(cooldown, CooldownMapping):
|
||||||
buckets: CooldownMapping[Context[Any]] = cooldown
|
buckets: CooldownMapping[Context[Any]] = cooldown
|
||||||
else:
|
else:
|
||||||
raise TypeError("Cooldown must be a an instance of CooldownMapping or None.")
|
raise TypeError("Cooldown must be an instance of CooldownMapping or None.")
|
||||||
self._buckets: CooldownMapping[Context[Any]] = buckets
|
self._buckets: CooldownMapping[Context[Any]] = buckets
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
@ -1322,28 +1322,28 @@ class ApplicationFlags(BaseFlags):
|
|||||||
|
|
||||||
.. describe:: x | y, x |= y
|
.. describe:: x | y, x |= y
|
||||||
|
|
||||||
Returns a ApplicationFlags instance with all enabled flags from
|
Returns an ApplicationFlags instance with all enabled flags from
|
||||||
both x and y.
|
both x and y.
|
||||||
|
|
||||||
.. versionadded:: 2.0
|
.. versionadded:: 2.0
|
||||||
|
|
||||||
.. describe:: x & y, x &= y
|
.. describe:: x & y, x &= y
|
||||||
|
|
||||||
Returns a ApplicationFlags instance with only flags enabled on
|
Returns an ApplicationFlags instance with only flags enabled on
|
||||||
both x and y.
|
both x and y.
|
||||||
|
|
||||||
.. versionadded:: 2.0
|
.. versionadded:: 2.0
|
||||||
|
|
||||||
.. describe:: x ^ y, x ^= y
|
.. describe:: x ^ y, x ^= y
|
||||||
|
|
||||||
Returns a ApplicationFlags instance with only flags enabled on
|
Returns an ApplicationFlags instance with only flags enabled on
|
||||||
only one of x or y, not on both.
|
only one of x or y, not on both.
|
||||||
|
|
||||||
.. versionadded:: 2.0
|
.. versionadded:: 2.0
|
||||||
|
|
||||||
.. describe:: ~x
|
.. describe:: ~x
|
||||||
|
|
||||||
Returns a ApplicationFlags instance with all flags inverted from x.
|
Returns an ApplicationFlags instance with all flags inverted from x.
|
||||||
|
|
||||||
.. versionadded:: 2.0
|
.. versionadded:: 2.0
|
||||||
|
|
||||||
@ -1518,28 +1518,28 @@ class AutoModPresets(ArrayFlags):
|
|||||||
|
|
||||||
.. describe:: x | y, x |= y
|
.. describe:: x | y, x |= y
|
||||||
|
|
||||||
Returns a AutoModPresets instance with all enabled flags from
|
Returns an AutoModPresets instance with all enabled flags from
|
||||||
both x and y.
|
both x and y.
|
||||||
|
|
||||||
.. versionadded:: 2.0
|
.. versionadded:: 2.0
|
||||||
|
|
||||||
.. describe:: x & y, x &= y
|
.. describe:: x & y, x &= y
|
||||||
|
|
||||||
Returns a AutoModPresets instance with only flags enabled on
|
Returns an AutoModPresets instance with only flags enabled on
|
||||||
both x and y.
|
both x and y.
|
||||||
|
|
||||||
.. versionadded:: 2.0
|
.. versionadded:: 2.0
|
||||||
|
|
||||||
.. describe:: x ^ y, x ^= y
|
.. describe:: x ^ y, x ^= y
|
||||||
|
|
||||||
Returns a AutoModPresets instance with only flags enabled on
|
Returns an AutoModPresets instance with only flags enabled on
|
||||||
only one of x or y, not on both.
|
only one of x or y, not on both.
|
||||||
|
|
||||||
.. versionadded:: 2.0
|
.. versionadded:: 2.0
|
||||||
|
|
||||||
.. describe:: ~x
|
.. describe:: ~x
|
||||||
|
|
||||||
Returns a AutoModPresets instance with all flags inverted from x.
|
Returns an AutoModPresets instance with all flags inverted from x.
|
||||||
|
|
||||||
.. versionadded:: 2.0
|
.. versionadded:: 2.0
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user