From 288f2d169e0e38e2a75353fdd4807f39a7f5b656 Mon Sep 17 00:00:00 2001 From: Bluesy <68259537+Bluesy1@users.noreply.github.com> Date: Tue, 16 Aug 2022 14:00:09 -0700 Subject: [PATCH] Document that docstrings can be used to document parameters --- discord/app_commands/commands.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/discord/app_commands/commands.py b/discord/app_commands/commands.py index cd5cdca8a..06de4d49f 100644 --- a/discord/app_commands/commands.py +++ b/discord/app_commands/commands.py @@ -2094,6 +2094,23 @@ def describe(**parameters: Union[str, locale_str]) -> Callable[[T], T]: async def ban(interaction: discord.Interaction, member: discord.Member): await interaction.response.send_message(f'Banned {member}') + Alternatively, you can describe parameters using Google, Sphinx, or Numpy style docstrings. + + Example: + + .. code-block:: python3 + + @app_commands.command() + async def ban(interaction: discord.Interaction, member: discord.Member): + \"\"\"Bans a member + + Parameters + ----------- + member: discord.Member + the member to ban + \"\"\" + await interaction.response.send_message(f'Banned {member}') + Parameters ----------- \*\*parameters: Union[:class:`str`, :class:`locale_str`]