Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix SlashCommandGroup descriptions pretending to be optional #1539

Merged
merged 1 commit into from
Jul 31, 2022
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
fix: SlashCommandGroup descriptions
they're supposed to be optional but break when put into validation
  • Loading branch information
Middledot committed Jul 31, 2022
commit 167b84467d3ec5bb1ca15e25222f3f4fd9773bf6
10 changes: 5 additions & 5 deletions discord/commands/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -619,7 +619,7 @@ def __new__(cls, *args, **kwargs) -> SlashCommand:
self.__original_kwargs__ = kwargs.copy()
return self

def __init__(self, func: Callable, *args, **kwargs) -> None:
def __init__(self, func: Callable, **kwargs) -> None:
super().__init__(func, **kwargs)
if not asyncio.iscoroutinefunction(func):
raise TypeError("Callback must be a coroutine.")
Expand Down Expand Up @@ -1016,10 +1016,10 @@ def __init__(
parent: Optional[SlashCommandGroup] = None,
**kwargs,
) -> None:
validate_chat_input_name(name)
validate_chat_input_description(description)
self.name = str(name)
self.description = description
self.name = name
self.description = description or "No description provided"
validate_chat_input_name(self.name)
validate_chat_input_description(self.description)
self.input_type = SlashCommandOptionType.sub_command_group
self.subcommands: List[Union[SlashCommand, SlashCommandGroup]] = self.__initial_commands__
self.guild_ids = guild_ids
Expand Down