Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions redbot/core/_global_checks.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,6 @@
def init_global_checks(bot):
@bot.check_once
async def check_message_is_eligible_as_command(ctx: commands.Context) -> bool:
if ctx.interaction is not None:
return True
Comment on lines +8 to +9
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should add a comment here and possibly also in Red.message_eligible_as_command so that we don't introduce discrepancies when changing the logic in the future:

Suggested change
if ctx.interaction is not None:
return True
if ctx.interaction is not None:
# equivalent checks are performed by `RedTree.interaction_check`
return True

return await ctx.bot.message_eligible_as_command(ctx.message)
6 changes: 5 additions & 1 deletion redbot/core/_settings_caches.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,14 +161,18 @@ async def get_ignored_channel(
discord.StageChannel,
discord.ForumChannel,
discord.Thread,
discord.Object, # This is solely here for the purpose of User Installed Bots,
# See Red#6501 & ignored_channel_or_guild in redbot/core/bot.py for more details.
],
check_category: bool = True,
) -> bool:
ret: bool

cid: int = channel.id
cat_id: Optional[int] = (
channel.category.id if check_category and channel.category else None
channel.category.id
if check_category and hasattr(channel, "category") and channel.category is not None
else None
)
if cid in self._cached_channels:
chan_ret = self._cached_channels[cid]
Expand Down
13 changes: 12 additions & 1 deletion redbot/core/bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -911,7 +911,18 @@ async def ignored_channel_or_guild(
return True

if isinstance(ctx.channel, discord.Thread):
channel = ctx.channel.parent
if isinstance(ctx, discord.Interaction) and ctx.is_user_integration():
ctx: discord.Interaction
# This is a user installed interaction, and thus... We're doomed!
# We must mock an object because we don't have the channel cached,
# and we are unable to fetch a full channel from the interaction
# #BlameDiscord, See Red#6501 for more details.

# LIMITATIONS: Due the fact that we don't know the categories either as they aren't...
# communicated in the interaction, we can't check for category ignores.
channel = discord.Object(id=ctx.channel.parent_id)
else:
channel = ctx.channel.parent
thread = ctx.channel
else:
channel = ctx.channel
Expand Down
Loading