From d83abf8a6f2f709ffa00b3c88c7bc27849393f22 Mon Sep 17 00:00:00 2001 From: onerandomusername Date: Sun, 14 Aug 2022 02:57:03 -0400 Subject: [PATCH] fix some bugs --- disnake/ext/commands/interaction_bot_base.py | 7 +++---- disnake/ext/commands/slash_core.py | 8 ++++---- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/disnake/ext/commands/interaction_bot_base.py b/disnake/ext/commands/interaction_bot_base.py index 8abfecadd1..7124bc5f6a 100644 --- a/disnake/ext/commands/interaction_bot_base.py +++ b/disnake/ext/commands/interaction_bot_base.py @@ -27,7 +27,6 @@ import sys import traceback import warnings -from itertools import chain from typing import ( TYPE_CHECKING, Any, @@ -495,7 +494,7 @@ def get_app_command( # this does not get commands by ID, use (some other method) to do that if not isinstance(name, str): raise TypeError(f"Expected name to be str, not {name.__class__}") - command = self._all_app_commands.get(AppCommandMetadata(chain[0], type=type, guild_id=guild_id)) # type: ignore + command = self._all_app_commands.get(AppCommandMetadata(name, type=type, guild_id=guild_id)) if command is None: return None return command @@ -947,7 +946,7 @@ async def _sync_application_commands(self) -> None: for guild_id, cmds in guild_cmds.items(): current_guild_cmds = self._connection._guild_application_commands.get(guild_id, {}) diff = _app_commands_diff(cmds, current_guild_cmds.values()) - if self._command_sync.allow_command_deletion: + if not self._command_sync.allow_command_deletion: # because allow_command_deletion is disabled, we want to never delete a command, so we move the delete commands to no_changes diff["no_changes"] += diff["delete"] diff["delete"].clear() @@ -1492,7 +1491,7 @@ async def process_application_commands( app_command = command break elif command.body.id is None: - str() + ... else: app_command = None diff --git a/disnake/ext/commands/slash_core.py b/disnake/ext/commands/slash_core.py index d316d7e19b..620c113f99 100644 --- a/disnake/ext/commands/slash_core.py +++ b/disnake/ext/commands/slash_core.py @@ -122,8 +122,8 @@ async def _call_autocompleter( class SubCommandGroup(InvokableApplicationCommand): """A class that implements the protocol for a bot slash command group. - These are not created manually, instead they are created via the - decorator or functional interface. + These are not created manually, instead they are created via the + decorator or functional interface. Attributes ---------- @@ -260,8 +260,8 @@ def decorator(func: CommandCallback) -> SubCommand: class SubCommand(InvokableApplicationCommand): """A class that implements the protocol for a bot slash subcommand. - These are not created manually, instead they are created via the - decorator or functional interface. + These are not created manually, instead they are created via the + decorator or functional interface. Attributes ----------