From bd26e7d5afa99cad6c9906fc24bc6bc9c485bb1a Mon Sep 17 00:00:00 2001 From: Kowlin <10947836+Kowlin@users.noreply.github.com> Date: Tue, 24 Dec 2024 15:16:03 +0100 Subject: [PATCH] Fix permissions fetching for User Installable Bots (#6457) Co-authored-by: Jakub Kuczys --- redbot/core/bot.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/redbot/core/bot.py b/redbot/core/bot.py index 6cba99d88..c63b2bb95 100644 --- a/redbot/core/bot.py +++ b/redbot/core/bot.py @@ -886,7 +886,12 @@ class Red( if ctx.channel.type is not discord.ChannelType.private: raise TypeError("Can't check permissions for non-private PartialMessageable.") is_private = True - perms = ctx.channel.permissions_for(author) + if isinstance(ctx, discord.Message): + perms = ctx.channel.permissions_for(author) + else: + # `permissions` attribute will use permissions from the interaction when possible, + # or `ctx.channel.permissions_for(author)` for non-interaction contexts. + perms = ctx.permissions surpass_ignore = ( is_private or perms.manage_guild