Use guild_id instead of inspecting guild
Previously, this line caused guild-specific commands to not
execute in guilds with the applications.commands scope. In this case,
SlashContext.guild is None and SlashContext.guild_id has the guild id.
This appears to be a holdover from pre-1.0.9 when SlashContext.guild
represented either a guild or a guild id.
@@ -722,10 +722,7 @@ class SlashCommand:
selected_cmd = self.commands[to_use["data"]["name"]]
- if selected_cmd.allowed_guild_ids:
- guild_id = ctx.guild.id if isinstance(ctx.guild, discord.Guild) else ctx.guild
-
- if guild_id not in selected_cmd.allowed_guild_ids:
+ if selected_cmd.allowed_guild_ids and ctx.guild_id not in selected_cmd.allowed_guild_ids:
return
if selected_cmd.has_subcommands and not selected_cmd.func:
