Handle UIB interactions for ignoring channels. (#6503)

Co-authored-by: Michael Oliveira <34169552+Flame442@users.noreply.github.com>
Co-authored-by: Jakub Kuczys <me@jacken.men>
This commit is contained in:
Kowlin
2026-03-04 21:38:30 +01:00
committed by GitHub
parent 45c55418a4
commit afe4e636b7
5 changed files with 37 additions and 6 deletions

View File

@@ -819,6 +819,9 @@ class Red(
Whether or not the message is eligible to be treated as a command.
"""
# NOTE: any changes to implementation here may need to be made
# in the `RedTree.interaction_check` as well
channel = message.channel
guild = message.guild
@@ -911,7 +914,18 @@ class Red(
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