Cog-Creators / Cog-Creators/Red-DiscordBot

Incorrect humanization of format_perms_list for MANAGE_ROLES in channel contexts

Open
#6,653 0 comments 0 reactions 0 assignees View on GitHub
Status: Needs Triage Type: Bug
Dominant language
Python
Stars
5.7k
Forks
2.5k
Avg merge
6d 16h
Merged PRs (30d)
1

Description

### 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_permissions` as 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](https://github.com/Cog-Creators/Red-DiscordBot/compare/V3/develop...Vexed01:Red-DiscordBot:diagnoseissues-channel-permissions) 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
Image

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.