Skip to content

Commit 8d17617

Browse files
krittickLulalaby
authored andcommitted
add missing guild_ids parameter to SlashCommandGroup.create_subgroup
1 parent b830ca4 commit 8d17617

File tree

1 file changed

+25
-2
lines changed

1 file changed

+25
-2
lines changed

discord/commands/core.py

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -941,12 +941,35 @@ def wrap(func) -> SlashCommand:
941941

942942
return wrap
943943

944-
def create_subgroup(self, name, description) -> SlashCommandGroup:
944+
def create_subgroup(
945+
self, name: str,
946+
description: Optional[str] = None,
947+
guild_ids: Optional[List[int]] = None,
948+
) -> SlashCommandGroup:
949+
"""
950+
Creates a new subgroup for this SlashCommandGroup.
951+
952+
Parameters
953+
----------
954+
name: :class:`str`
955+
The name of the group to create.
956+
description: Optional[:class:`str`]
957+
The description of the group to create.
958+
guild_ids: Optional[List[:class:`int`]]
959+
A list of the IDs of each guild this group should be added to, making it a guild command.
960+
This will be a global command if ``None`` is passed.
961+
962+
Returns
963+
--------
964+
SlashCommandGroup
965+
The slash command group that was created.
966+
"""
967+
945968
if self.parent is not None:
946969
# TODO: Improve this error message
947970
raise Exception("Subcommands can only be nested once")
948971

949-
sub_command_group = SlashCommandGroup(name, description, parent=self)
972+
sub_command_group = SlashCommandGroup(name, description, guild_ids, parent=self)
950973
self.subcommands.append(sub_command_group)
951974
return sub_command_group
952975

0 commit comments

Comments
 (0)