From 8c6bb90659ee0f8a54722938cff65773420d0fb0 Mon Sep 17 00:00:00 2001 From: EQUENOS <50338932+EQUENOS@users.noreply.github.com> Date: Mon, 25 Sep 2023 00:42:07 +0300 Subject: [PATCH] chore: add suggested typings --- disnake/ext/commands/interaction_bot_base.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/disnake/ext/commands/interaction_bot_base.py b/disnake/ext/commands/interaction_bot_base.py index 83cc6e73ce..e1c5835774 100644 --- a/disnake/ext/commands/interaction_bot_base.py +++ b/disnake/ext/commands/interaction_bot_base.py @@ -490,12 +490,12 @@ def _emulate_old_app_command_remove(self, cmd_type: ApplicationCommandType, name "Use remove_app_command instead.", stacklevel=3, ) - bad_keys = [] + bad_keys: List[AppCmdIndex] = [] for key in self.all_app_commands.keys(): if key.type is cmd_type and key.name == name: bad_keys.append(key) - result = None + result: Optional[InvokableApplicationCommand] = None for key in bad_keys: cmd = self.all_app_commands.pop(key, None) if result is None: @@ -517,7 +517,7 @@ def remove_slash_command(self, name: str) -> Optional[InvokableSlashCommand]: Optional[:class:`InvokableSlashCommand`] The slash command that was removed. If the name is not valid then ``None`` is returned instead. """ - self._emulate_old_app_command_remove(ApplicationCommandType.chat_input, name) + return self._emulate_old_app_command_remove(ApplicationCommandType.chat_input, name) def remove_user_command(self, name: str) -> Optional[InvokableUserCommand]: """Removes an :class:`InvokableUserCommand` from the internal list @@ -533,7 +533,7 @@ def remove_user_command(self, name: str) -> Optional[InvokableUserCommand]: Optional[:class:`InvokableUserCommand`] The user command that was removed. If the name is not valid then ``None`` is returned instead. """ - self._emulate_old_app_command_remove(ApplicationCommandType.user, name) + return self._emulate_old_app_command_remove(ApplicationCommandType.user, name) def remove_message_command(self, name: str) -> Optional[InvokableMessageCommand]: """Removes an :class:`InvokableMessageCommand` from the internal list @@ -549,7 +549,7 @@ def remove_message_command(self, name: str) -> Optional[InvokableMessageCommand] Optional[:class:`InvokableMessageCommand`] The message command that was removed. If the name is not valid then ``None`` is returned instead. """ - self._emulate_old_app_command_remove(ApplicationCommandType.message, name) + return self._emulate_old_app_command_remove(ApplicationCommandType.message, name) def get_slash_command( self, name: str, guild_id: Optional[int] = MISSING @@ -966,8 +966,8 @@ def decorator( def _ordered_unsynced_commands( self, ) -> Tuple[List[ApplicationCommand], Dict[int, List[ApplicationCommand]]]: - global_cmds = [] - guilds = {} + global_cmds: List[ApplicationCommand] = [] + guilds: Dict[int, List[ApplicationCommand]] = {} for key, cmd in self.all_app_commands.items(): if not cmd.auto_sync: