Skip to content

Commit 9cb4bb3

Browse files
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.
1 parent 36ce1f6 commit 9cb4bb3

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

discord_slash/client.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -722,11 +722,8 @@ async def on_socket_response(self, msg):
722722

723723
selected_cmd = self.commands[to_use["data"]["name"]]
724724

725-
if selected_cmd.allowed_guild_ids:
726-
guild_id = ctx.guild.id if isinstance(ctx.guild, discord.Guild) else ctx.guild
727-
728-
if guild_id not in selected_cmd.allowed_guild_ids:
729-
return
725+
if selected_cmd.allowed_guild_ids and ctx.guild_id not in selected_cmd.allowed_guild_ids:
726+
return
730727

731728
if selected_cmd.has_subcommands and not selected_cmd.func:
732729
return await self.handle_subcommand(ctx, to_use)

0 commit comments

Comments
 (0)