Handle UIB interactions for ignoring channels. #6503

Merged
Kowlin merged 7 commits from pr/fix/user-installable-ignore-check into V3/develop 2026-03-04 21:38:31 +01:00
Kowlin commented 2025-01-06 03:44:36 +01:00 (Migrated from github.com)

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

### 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
Flame442 commented 2025-01-07 05:11:54 +01:00 (Migrated from github.com)

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
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. ```python 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 ```
Kowlin commented 2025-02-02 00:43:09 +01:00 (Migrated from github.com)

Hybirds are now handled properly!
image

Hybirds are now handled properly! ![image](https://github.com/user-attachments/assets/22faf9a4-854d-49c5-bc2d-9da8d14e7e04)
Jackenmen (Migrated from github.com) requested changes 2025-02-03 01:51:00 +01:00
Jackenmen (Migrated from github.com) left a comment

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.

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.
@ -5,4 +5,7 @@ from . import commands
def init_global_checks(bot):
Jackenmen (Migrated from github.com) commented 2025-02-03 01:45:31 +01:00

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:

        if ctx.interaction is not None:
            # equivalent checks are performed by `RedTree.interaction_check`
            return True
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: ```suggestion if ctx.interaction is not None: # equivalent checks are performed by `RedTree.interaction_check` return True ```
Jackenmen (Migrated from github.com) reviewed 2026-03-04 21:27:01 +01:00
Jackenmen (Migrated from github.com) approved these changes 2026-03-04 21:31:59 +01:00
Sign in to join this conversation.
No reviewers
No labels
Automated PR
Blocked
Blocked By: Damage Control
Blocked By: Dependency
Blocked By: Other PR
Breaking Change
Category: CI
Category: Cogs - Admin
Category: Cogs - Alias
Category: Cogs - Audio
Category: Cogs - Bank
Category: Cogs - Cleanup
Category: Cogs - CustomCommands
Category: Cogs - Dev
Category: Cogs - Downloader
Category: Cogs - Economy
Category: Cogs - Filter
Category: Cogs - General
Category: Cogs - Image
Category: Cogs - Mod
Category: Cogs - Modlog
Category: Cogs - Mutes
Category: Cogs - Permissions
Category: Cogs - Reports
Category: Cogs - Streams
Category: Cogs - Trivia
Category: Cogs - Trivia - Lists
Category: Cogs - Warnings
Category: Core - API - App Commands Package
Category: Core - API - Audio
Category: Core - API - Bank
Category: Core - API - Commands Package
Category: Core - API - Config
Category: Core - API - Other
Category: Core - API - Utils Package
Category: Core - Bot Class
Category: Core - Bot Commands
Category: Core - Command-line Interfaces
Category: Core - Downloader
Category: Core - Help
Category: Core - i18n
Category: Core - Modlog
Category: Core - Other Internals
Category: Core - RPC/ZMQ
Category: Docker
Category: Docs - Changelogs
Category: Docs - For Developers
Category: Docs - Install Guides
Category: Docs - Other
Category: Docs - User Guides
Category: Meta
Category: RPC/ZMQ methods
Category: Vendored Packages
Changelog Entry: Added
Changelog Entry: Pending
Changelog Entry: Skipped
Closed: Duplicate
Closed: External
Closed: Invalid
Closed: User Error
Closed: Won't Fix
Complex Issue
Docs-only
Feature Branch
Good First Issue
Help Wanted
High Priority
Needs Backport To stable-docs
No Activity
No Repro
QA: Bypassed
QA: Changes Requested
QA: Passed
Release Blocker
Status: Accepted
Status: Frozen
Status: In Progress
Status: Needs Discussion
Status: Needs Info
Status: Needs Triage
Status: PRs Welcome
Type: Bug
Type: Dependency Update
Type: Deprecation
Type: Enhancement
Type: Feature
Type: Informational
Type: Merge
Type: Optimisation
Type: Question
Type: Removal
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
Mrcoolgamer11/Red-DiscordBot!6503
No description provided.