Skip to content

Commit 43c0864

Browse files
committed
Add missing documentation and parameters
Closes #1469
1 parent ea230a1 commit 43c0864

File tree

1 file changed

+27
-7
lines changed

1 file changed

+27
-7
lines changed

discord/commands/core.py

Lines changed: 27 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -963,17 +963,19 @@ class SlashCommandGroup(ApplicationCommand):
963963
Whether the command should only be usable inside a guild.
964964
default_member_permissions: :class:`~discord.Permissions`
965965
The default permissions a member needs to be able to run the command.
966-
subcommands: List[Union[:class:`SlashCommand`, :class:`SlashCommandGroup`]]
967-
The list of all subcommands under this group.
968-
cog: Optional[:class:`.Cog`]
969-
The cog that this command belongs to. ``None`` if there isn't one.
970966
checks: List[Callable[[:class:`.ApplicationContext`], :class:`bool`]]
971967
A list of predicates that verifies if the command could be executed
972968
with the given :class:`.ApplicationContext` as the sole parameter. If an exception
973969
is necessary to be thrown to signal failure, then one inherited from
974970
:exc:`.ApplicationCommandError` should be used. Note that if the checks fail then
975971
:exc:`.CheckFailure` exception is raised to the :func:`.on_application_command_error`
976972
event.
973+
name_localizations: Optional[Dict[:class:`str`, :class:`str`]]
974+
The name localizations for this command. The values of this should be ``"locale": "name"``. See
975+
`here <https://discord.com/developers/docs/reference#locales>`_ for a list of valid locales.
976+
description_localizations: Optional[Dict[:class:`str`, :class:`str`]]
977+
The description localizations for this command. The values of this should be ``"locale": "description"``.
978+
See `here <https://discord.com/developers/docs/reference#locales>`_ for a list of valid locales.
977979
"""
978980
__initial_commands__: List[Union[SlashCommand, SlashCommandGroup]]
979981
type = 1
@@ -1003,7 +1005,7 @@ def __new__(cls, *args, **kwargs) -> SlashCommandGroup:
10031005
def __init__(
10041006
self,
10051007
name: str,
1006-
description: str,
1008+
description: Optional[str] = None,
10071009
guild_ids: Optional[List[int]] = None,
10081010
parent: Optional[SlashCommandGroup] = None,
10091011
**kwargs,
@@ -1070,6 +1072,7 @@ def create_subgroup(
10701072
name: str,
10711073
description: Optional[str] = None,
10721074
guild_ids: Optional[List[int]] = None,
1075+
**kwargs,
10731076
) -> SlashCommandGroup:
10741077
"""
10751078
Creates a new subgroup for this SlashCommandGroup.
@@ -1083,6 +1086,23 @@ def create_subgroup(
10831086
guild_ids: Optional[List[:class:`int`]]
10841087
A list of the IDs of each guild this group should be added to, making it a guild command.
10851088
This will be a global command if ``None`` is passed.
1089+
guild_only: :class:`bool`
1090+
Whether the command should only be usable inside a guild.
1091+
default_member_permissions: :class:`~discord.Permissions`
1092+
The default permissions a member needs to be able to run the command.
1093+
checks: List[Callable[[:class:`.ApplicationContext`], :class:`bool`]]
1094+
A list of predicates that verifies if the command could be executed
1095+
with the given :class:`.ApplicationContext` as the sole parameter. If an exception
1096+
is necessary to be thrown to signal failure, then one inherited from
1097+
:exc:`.ApplicationCommandError` should be used. Note that if the checks fail then
1098+
:exc:`.CheckFailure` exception is raised to the :func:`.on_application_command_error`
1099+
event.
1100+
name_localizations: Optional[Dict[:class:`str`, :class:`str`]]
1101+
The name localizations for this command. The values of this should be ``"locale": "name"``. See
1102+
`here <https://discord.com/developers/docs/reference#locales>`_ for a list of valid locales.
1103+
description_localizations: Optional[Dict[:class:`str`, :class:`str`]]
1104+
The description localizations for this command. The values of this should be ``"locale": "description"``.
1105+
See `here <https://discord.com/developers/docs/reference#locales>`_ for a list of valid locales.
10861106
10871107
Returns
10881108
--------
@@ -1092,9 +1112,9 @@ def create_subgroup(
10921112

10931113
if self.parent is not None:
10941114
# TODO: Improve this error message
1095-
raise Exception("Subcommands can only be nested once")
1115+
raise Exception("a subgroup cannot have a subgroup")
10961116

1097-
sub_command_group = SlashCommandGroup(name, description, guild_ids, parent=self)
1117+
sub_command_group = SlashCommandGroup(name, description, guild_ids, parent=self, **kwargs)
10981118
self.subcommands.append(sub_command_group)
10991119
return sub_command_group
11001120

0 commit comments

Comments
 (0)