Skip to content

Commit 7da9d4d

Browse files
Start documenting SlashCommand
1 parent 93fc094 commit 7da9d4d

File tree

1 file changed

+31
-1
lines changed

1 file changed

+31
-1
lines changed

discord/commands/commands.py

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,37 @@ async def call_after_hooks(self, ctx: ApplicationContext) -> None:
295295
await hook(ctx)
296296

297297
class SlashCommand(ApplicationCommand):
298+
r"""A class that implements the protocol for a slash command.
299+
300+
These are not created manually, instead they are created via the
301+
decorator or functional interface.
302+
303+
Attributes
304+
-----------
305+
name: :class:`str`
306+
The name of the command.
307+
callback: :ref:`coroutine <coroutine>`
308+
The coroutine that is executed when the command is called.
309+
description: Optional[:class:`str`]
310+
The description for the command.
311+
guild_ids: Optional[List[:class:`int`]]
312+
The ids of the guilds where this command will be registered.
313+
options: List[:class:`Option`]
314+
The parameters for this command.
315+
default_permission: :class:`bool`
316+
Whether the command is enabled by default when it is added to a guild.
317+
permissions: List[:class:`Permission`]
318+
The permissions for this command.
319+
cog: Optional[:class:`Cog`]
320+
The cog that this command belongs to. ``None`` if there isn't one.
321+
checks: List[Callable[[:class:`.Context`], :class:`bool`]]
322+
A list of predicates that verifies if the command could be executed
323+
with the given :class:`.ApplicationContext` as the sole parameter. If an exception
324+
is necessary to be thrown to signal failure, then one inherited from
325+
:exc:`.CommandError` should be used. Note that if the checks fail then
326+
:exc:`.CheckFailure` exception is raised to the :func:`.on_application_command_error`
327+
event.
328+
"""
298329
type = 1
299330

300331
def __new__(cls, *args, **kwargs) -> SlashCommand:
@@ -348,7 +379,6 @@ def __init__(self, func: Callable, *args, **kwargs) -> None:
348379
def parse_options(self, params) -> List[Option]:
349380
final_options = []
350381

351-
params = self._get_signature_parameters()
352382
if list(params.items())[0][0] == "self":
353383
temp = list(params.items())
354384
temp.pop(0)

0 commit comments

Comments
 (0)