Incorrect humanization of format_perms_list for MANAGE_ROLES in channel contexts #6653
Labels
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
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
Mrcoolgamer11/Red-DiscordBot#6653
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What component of Red (cog, command, API) would you like to see improvements on?
API - utils.chat_formatting
Describe the enhancement you're suggesting.
Currently, format_perms_list assumes a guild context when humanizing MANAGE_ROLES. This is problematic because in the Discord client UI, at channel/category level the MANAGE_ROLES permission is shown as "Manage Permissions" while at role-level it is "Manage Roles".
This leads to the behaviour where if "Manage Permissions" is disabled for a role/user at channel level and
@commands.bot_has_permissions(manage_roles=True)decorator is added, the bot will say that the "Manage Roles" permission is required when it is actually the "Manage Permissions" permission that needs to be granted (even if Manage Roles is given at role-level, this will still happen if Manage Permissions is explicitly denied at channel-level).I "fixed" this in my cog by changing the deco to
bot_has_guild_permissionsas that was the behaviour I actually intended.Therefore the format_perms_list util should have an optional arg for channel context and which would have the functionaliy of replacing Manage Roles with Manage Permissions
Anything else?
I wrote this for format_perms_list before realising I wasn't sure how to implement checking if MANAGE_ROLES was denied at channel or role/user level. Or maybe I'm just overthinking. I can PR just this if wanted.
Example diagnose issues output when the bot has Manage Role permissions but has Manage Permissions explicitly denied at channel-level, so it is misleading

Behoben in
72080fe04:format_perms_list()hat jetzt ein Argumentchannel_context. Der Handler für fehlende Bot-Berechtigungen nutzt es, wenn der Bot "Manage Roles" auf Server-Ebene hat, die Berechtigung also in den Kanal-Overwrites verweigert wurde, und nennt sie dann wie Discord "Manage Permissions".Generated by Claude Code