Skip to content

Commit

Permalink
fix: Update typehints and docstrings of `SlashCommandGroup.walk_comma…
Browse files Browse the repository at this point in the history
…nds()`

to now return both `SlashCommand`s and `SlashCommandGroup`s
  • Loading branch information
krishnans2006 committed Feb 14, 2023
1 parent 3b762f9 commit 695fe99
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions discord/commands/core.py
Expand Up @@ -1317,13 +1317,15 @@ async def invoke_autocomplete_callback(self, ctx: AutocompleteContext) -> None:
ctx.interaction.data = option
await command.invoke_autocomplete_callback(ctx)

def walk_commands(self) -> Generator[SlashCommand, None, None]:
"""An iterator that recursively walks through all slash commands in this group.
def walk_commands(self) -> Generator[SlashCommand | SlashCommandGroup, None, None]:
"""An iterator that recursively walks through all slash commands and groups in this group.
Yields
------
:class:`.SlashCommand`
A slash command from the group.
:class:`.SlashCommandGroup`
A nested slash command group from the group.
"""
for command in self.subcommands:
if isinstance(command, SlashCommandGroup):
Expand Down

0 comments on commit 695fe99

Please sign in to comment.