From ef591e697034296f44319adcc3abbe2255a6017b Mon Sep 17 00:00:00 2001 From: EQUENOS <50338932+EQUENOS@users.noreply.github.com> Date: Mon, 25 Sep 2023 00:58:23 +0300 Subject: [PATCH] chore: simplify ambiguity checks --- disnake/ext/commands/interaction_bot_base.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/disnake/ext/commands/interaction_bot_base.py b/disnake/ext/commands/interaction_bot_base.py index 9f122e2eba..e3a1200d9d 100644 --- a/disnake/ext/commands/interaction_bot_base.py +++ b/disnake/ext/commands/interaction_bot_base.py @@ -605,11 +605,8 @@ def get_slash_command( continue if result is None: result = chain_match - continue # we should check whether there's an ambiguity in command search - result_guild_ids = (result.root_parent or result).guild_ids - match_guild_ids = (chain_match.root_parent or chain_match).guild_ids - if result_guild_ids != match_guild_ids: + elif chain_match is not result: raise ValueError( "Argument guild_id must be provided if there're different slash commands " "with the same name but different guilds or one of them is global." @@ -656,7 +653,7 @@ def get_user_command( if result is None: result = command # we should check whether there's an ambiguity in command search - elif result.guild_ids != command.guild_ids: + elif command is not result: raise ValueError( "Argument guild_id must be provided if there're different user commands " "with the same name but different guilds or one of them is global." @@ -705,7 +702,7 @@ def get_message_command( if result is None: result = command # we should check whether there's an ambiguity in command search - elif result.guild_ids != command.guild_ids: + elif command is not result: raise ValueError( "Argument guild_id must be provided if there're different message commands " "with the same name but different guilds or one of them is global."