Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion discord/ext/commands/cog.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
import discord
from ...cog import Cog

from typing import Any, Callable, Generator, TYPE_CHECKING, TypeVar, Type
from typing import Any, Callable, Generator, TYPE_CHECKING, TypeVar, Type, Union

from ...commands import ApplicationCommand

Expand Down Expand Up @@ -67,3 +67,16 @@ def walk_commands(self) -> Generator[Command, None, None]:
yield command
if isinstance(command, GroupMixin):
yield from command.walk_commands()

def get_commands(self) -> List[Union[ApplicationCommand, Command]]:
r"""
Returns
--------
List[Union[:class:`~discord.ApplicationCommand`, :class:`.Command`]]
A :class:`list` of commands that are defined inside this cog.

.. note::

This does not include subcommands.
"""
return [c for c in self.__cog_commands__ if c.parent is None]