Skip to content

Commit

Permalink
Fix linting issues
Browse files Browse the repository at this point in the history
  • Loading branch information
EQUENOS committed Sep 18, 2023
1 parent ec3896d commit ea1ad65
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
4 changes: 3 additions & 1 deletion disnake/ext/commands/errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -1045,7 +1045,9 @@ class AppCommandRegistrationError(CommandRegistrationError):
or ``None`` if it was a global command.
"""

def __init__(self, cmd_type: ApplicationCommandType, name: str, guild_id: Optional[int]) -> None:
def __init__(
self, cmd_type: ApplicationCommandType, name: str, guild_id: Optional[int]
) -> None:
self.cmd_type: ApplicationCommandType = cmd_type
self.name: str = name
self.guild_id: Optional[int] = guild_id
Expand Down
16 changes: 10 additions & 6 deletions disnake/ext/commands/interaction_bot_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,9 @@ def user_commands(self) -> Set[InvokableUserCommand]:
def message_commands(self) -> Set[InvokableMessageCommand]:
"""Set[:class:`InvokableMessageCommand`]: A set of all message commands the bot has."""
return set(
cmd for cmd in self.all_app_commands.values() if isinstance(cmd, InvokableMessageCommand)
cmd
for cmd in self.all_app_commands.values()
if isinstance(cmd, InvokableMessageCommand)
)

@property
Expand Down Expand Up @@ -351,7 +353,9 @@ def add_app_command(self, app_command: InvokableApplicationCommand) -> None:
raise NotImplementedError("This method is only usable in disnake.Client subclasses")

if not isinstance(app_command, InvokableApplicationCommand):
raise TypeError("The app_command passed must be an instance of InvokableApplicationCommand")
raise TypeError(
"The app_command passed must be an instance of InvokableApplicationCommand"
)

if app_command.guild_ids is None:
# if test_guilds are specified then we add the same command for each test guild
Expand All @@ -364,7 +368,9 @@ def add_app_command(self, app_command: InvokableApplicationCommand) -> None:
type=app_command.body.type, name=app_command.name, guild_id=guild_id
)
if cmd_index in self.all_app_commands:
raise AppCommandRegistrationError(cmd_index.type, cmd_index.name, cmd_index.guild_id)
raise AppCommandRegistrationError(
cmd_index.type, cmd_index.name, cmd_index.guild_id
)

# localization may be called multiple times for the same command but it's harmless
app_command.body.localize(self.i18n)
Expand Down Expand Up @@ -625,9 +631,7 @@ def get_user_command(
The user command that was requested. If not found, returns ``None``.
"""
if guild_id is not MISSING:
cmd_index = AppCmdIndex(
type=ApplicationCommandType.user, name=name, guild_id=guild_id
)
cmd_index = AppCmdIndex(type=ApplicationCommandType.user, name=name, guild_id=guild_id)
command = self.all_app_commands.get(cmd_index)
if command is None:
return None
Expand Down

0 comments on commit ea1ad65

Please sign in to comment.