From 695fe99670565cac074503242c3a26af5c87eb9f Mon Sep 17 00:00:00 2001 From: Krishnan Shankar Date: Tue, 14 Feb 2023 11:55:27 -0500 Subject: [PATCH] fix: Update typehints and docstrings of `SlashCommandGroup.walk_commands()` to now return both `SlashCommand`s and `SlashCommandGroup`s --- discord/commands/core.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/discord/commands/core.py b/discord/commands/core.py index 792adda6d7..b43f756b01 100644 --- a/discord/commands/core.py +++ b/discord/commands/core.py @@ -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):