[Core] Multiple mod admin roles #2783

Merged
DiscordLiz merged 14 commits from multiple-mod-admin-roles into V3/develop 2019-06-24 05:36:00 +02:00
DiscordLiz commented 2019-06-21 17:41:43 +02:00 (Migrated from github.com)

Type

  • Bugfix
  • Enhancement
  • New feature

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.

### Type - [ ] Bugfix - [X] Enhancement - [ ] New feature ### 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.
palmtree5 (Migrated from github.com) reviewed 2019-06-21 17:41:43 +02:00
tekulvw (Migrated from github.com) reviewed 2019-06-21 17:41:43 +02:00
Twentysix26 (Migrated from github.com) reviewed 2019-06-21 17:41:43 +02:00
mikeshardmind commented 2019-06-21 17:50:48 +02:00 (Migrated from github.com)

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.

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.
mikeshardmind commented 2019-06-21 21:44:05 +02:00 (Migrated from github.com)

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.

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.
Flame442 (Migrated from github.com) requested changes 2019-06-22 17:52:10 +02:00
Flame442 (Migrated from github.com) left a comment

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>role might need to get the same treatment.

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>role` might need to get the same treatment.
@ -734,23 +736,60 @@ class Core(commands.Cog, CoreLogic):
guild_settings=guild_settings,
locale=locale,
)
Flame442 (Migrated from github.com) commented 2019-06-22 17:46:40 +02:00

This line and L756 probably should be "That role is already a[n] <admin/mod> role.".

This line and L756 probably should be "That role is already a[n] <admin/mod> role.".
Flame442 (Migrated from github.com) commented 2019-06-22 17:47:40 +02:00

This line and L758, "That role was added" doesn't sound very good, maybe a simple "Role added successfully."?

This line and L758, "That role was added" doesn't sound very good, maybe a simple "Role added successfully."?
Flame442 (Migrated from github.com) commented 2019-06-22 17:49:16 +02:00

This line and L778 probably should be "That role was already not a[n] <admin/mod> role".

This line and L778 probably should be "That role was already not a[n] <admin/mod> role".
DiscordLiz (Migrated from github.com) reviewed 2019-06-23 01:42:26 +02:00
@ -734,23 +736,60 @@ class Core(commands.Cog, CoreLogic):
guild_settings=guild_settings,
locale=locale,
)
DiscordLiz (Migrated from github.com) commented 2019-06-23 01:42:26 +02:00

I went with something different here, let me know if it sounds better to you.

I went with something different here, let me know if it sounds better to you.
mikeshardmind (Migrated from github.com) requested changes 2019-06-23 07:00:49 +02:00
mikeshardmind (Migrated from github.com) left a comment

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.

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 the
mikeshardmind (Migrated from github.com) commented 2019-06-23 06:57:01 +02:00

If 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-WARN to 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.

If 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-WARN` to 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.
mikeshardmind (Migrated from github.com) commented 2019-06-23 07:00:04 +02:00

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.

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.
mikeshardmind (Migrated from github.com) requested changes 2019-06-23 09:41:14 +02:00
@ -126,16 +126,14 @@ class PrivilegeLevel(enum.IntEnum):
# The following is simply an optimised way to check if the user has the
mikeshardmind (Migrated from github.com) commented 2019-06-23 09:41:09 +02:00

I 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.

        member_snowflakes = ctx.author._roles  # DEP-WARN
I 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. ```suggestion member_snowflakes = ctx.author._roles # DEP-WARN ```
Flame442 (Migrated from github.com) reviewed 2019-06-24 05:15:53 +02:00
Flame442 (Migrated from github.com) left a comment
No description provided.
While I still don't love the "this" in "This role is already an <admin/mod> role.", the changes I requested have been addressed.
mikeshardmind (Migrated from github.com) reviewed 2019-06-24 05:25:25 +02:00
mikeshardmind (Migrated from github.com) left a comment
No description provided.
Thanks @DiscordLiz for the quick follow up on issues discussed both here and in Discord. :tada:
mikeshardmind (Migrated from github.com) approved these changes 2019-06-24 05:33:46 +02:00
Sign in to join this conversation.
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!2783
No description provided.