[Core] Multiple mod admin roles #2783
No reviewers
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 project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
Mrcoolgamer11/Red-DiscordBot!2783
Loading…
Reference in a new issue
No description provided.
Delete branch "multiple-mod-admin-roles"
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?
Type
Description of the changes
This allows multiple mod and admin roles to be used.
I've updated everywhere which uses it directly.
If cog developers are expected to be allowed to interact with the bot's settings directly, this is also a breaking change.
I don't think we ever publicly documented the bot's db. I'm inclined to say that even if this may break someone, they should be using the exposed documented functions instead of this. I'm happy to review it later, and open to discussing delaying this for a breaking release if someone disagrees with that stance.
A note for anyone going to test this: Since it modifies the bot's db including the types of things in it, I suggest testing with a brand new instance or a copy of a prior one.
I haven't had a chance to run this on a bot yet, however I looked over the strings a bit and have some changes to suggest.
-All doc strings: The spaces in between the text and the quotes should be removed for consistency with the rest of red
-All doc strings: Missing periods at the end.
-I remember a PR at some point added consistency to all of the del/delete/rem/remove commands by aliasing all of that,
[p]set remove<mod/admin>rolemight need to get the same treatment.@ -734,23 +736,60 @@ class Core(commands.Cog, CoreLogic):guild_settings=guild_settings,locale=locale,)This line and L756 probably should be "That role is already a[n] <admin/mod> role.".
This line and L758, "That role was added" doesn't sound very good, maybe a simple "Role added successfully."?
This line and L778 probably should be "That role was already not a[n] <admin/mod> role".
@ -734,23 +736,60 @@ class Core(commands.Cog, CoreLogic):guild_settings=guild_settings,locale=locale,)I went with something different here, let me know if it sounds better to you.
I need to do a bit more actual testing with this (not a full review), but it's what I've noticed so far.
Definitely liking most of what I'm seeing here so far.
@ -126,16 +126,14 @@ class PrivilegeLevel(enum.IntEnum):# The following is simply an optimised way to check if the user has theIf you could change this section to do the role lookup using
ctx.author._roles.has(role_id)and not convert to a set, short circuiting on admin roles first, That would be great. Additionally, please add# DEP-WARNto each line using this. We'd like to get the most performance possible out of this section, but we do need to take caution with the internals here.This section looks fine at a glance, but it warrants adding pagination to the send below to prevent something really stupid with large number of roles.
@ -126,16 +126,14 @@ class PrivilegeLevel(enum.IntEnum):# The following is simply an optimised way to check if the user has theI don't mean to nitpick too much here, but seeing it side by side with how you named the other instance of this, the other form is much more legible.