Skip to content

Handle UIB interactions for ignoring channels. #6503

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: V3/develop
Choose a base branch
from

Conversation

Kowlin
Copy link
Member

@Kowlin Kowlin commented Jan 6, 2025

Description of the changes

Fixes #6501, this PR handles User Installed Bot interactions where they will error out on trying to check from Threads, as it cannot get the channels it need. Furthermore, this handling like this will NOT check for categories, as the bot cannot gather those from a context where it can only get information from the interaction. Tough luck...

Have the changes in this PR been tested?

Yes, but only internally, this must be tested by trying to reproduce the original error from #6501

@github-actions github-actions bot added Category: Core - Bot Class This is related to the `redbot.core.bot.Red` class. Category: Core - Other Internals This is related to core internals that don't have a dedicated label. labels Jan 6, 2025
@Kowlin Kowlin added the Type: Bug Unexpected behavior, result, or exception. In case of PRs, it is a fix for the foregoing. label Jan 6, 2025
@Flame442
Copy link
Member

Flame442 commented Jan 7, 2025

Fixes the issues for pure app commands, but there is still a remaining error for hybrids in particular. Not sure if we want to just fix that here, or if we want to save that for another PR.

File "venv\lib\site-packages\redbot\core\_global_checks.py", line 8, in check_message_is_eligible_as_command
    return await ctx.bot.message_eligible_as_command(ctx.message)
  File "venv\lib\site-packages\redbot\core\bot.py", line 844, in message_eligible_as_command
    if not can_user_send_messages_in(guild.me, channel):
  File "venv\lib\site-packages\redbot\core\utils\__init__.py", line 724, in can_user_send_messages_in
    perms = channel.permissions_for(obj)
  File "venv\lib\site-packages\discord\threads.py", line 425, in permissions_for
    raise ClientException('Parent channel not found')
discord.errors.ClientException: Parent channel not found

@Flame442 Flame442 self-assigned this Jan 7, 2025
@Kowlin
Copy link
Member Author

Kowlin commented Feb 1, 2025

Hybirds are now handled properly!
image

Copy link
Member

@Jackenmen Jackenmen left a comment

Choose a reason for hiding this comment

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

I'm only really concerned about proper documentation here - there used to be just one flow that everything went through. Now that we continue to have to fix things for various interactions and the implementation is split between different places, it would be good to inform the code reader about the traps - see the review comment for a specific suggestion.
It might also be worth updating help text / messages from the [p]ignore command such that the user knows that the category ignores won't apply to user-installed commands.

Comment on lines +8 to +9
if ctx.interaction is not None:
return True
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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Category: Core - Bot Class This is related to the `redbot.core.bot.Red` class. Category: Core - Other Internals This is related to core internals that don't have a dedicated label. Type: Bug Unexpected behavior, result, or exception. In case of PRs, it is a fix for the foregoing.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Commands Used in Threads as User-Installed App
3 participants