[Admin] Allow selfroleset command to consume multiple roles #5238

Merged
Kreusada merged 12 commits from patch-70 into V3/develop 2021-09-02 00:37:45 +02:00
Kreusada commented 2021-09-01 00:24:41 +02:00 (Migrated from github.com)

Closes #5237. Allows the selfroleset commands to consume multiple roles

These changes have been tested

Closes #5237. Allows the selfroleset commands to consume multiple roles These changes have been tested
Jackenmen (Migrated from github.com) requested changes 2021-09-01 18:49:47 +02:00
@ -450,45 +450,64 @@ class Admin(commands.Cog):
pass
Jackenmen (Migrated from github.com) commented 2021-09-01 18:44:55 +02:00

You should use two separate strings for the singular and plural forms.

You should use two separate strings for the singular and plural forms.
Jackenmen (Migrated from github.com) commented 2021-09-01 18:45:52 +02:00

You should use two separate strings for the singular and plural forms.

You should use two separate strings for the singular and plural forms.
Jackenmen (Migrated from github.com) commented 2021-09-01 18:47:08 +02:00

Styling

                        "I cannot let you add {role.name} as a selfrole because that role is"
                        " higher than or equal to your highest role in the Discord hierarchy."
Styling ```suggestion "I cannot let you add {role.name} as a selfrole because that role is" " higher than or equal to your highest role in the Discord hierarchy." ```
Jackenmen (Migrated from github.com) commented 2021-09-01 18:48:53 +02:00

Styling

                        "I cannot let you remove {role.name} from being a selfrole"
                        " because that role is higher than or equal to your highest role"
                        " in the Discord hierarchy."
Styling ```suggestion "I cannot let you remove {role.name} from being a selfrole" " because that role is higher than or equal to your highest role" " in the Discord hierarchy." ```
Jackenmen (Migrated from github.com) requested changes 2021-09-01 19:02:54 +02:00
@ -470,3 +475,3 @@
return
await ctx.send(_("That role is already a selfrole."))
await self.config.guild(ctx.guild).selfroles.set(current_selfroles)
Jackenmen (Migrated from github.com) commented 2021-09-01 19:02:34 +02:00
            message = _("Removed {count} selfroles.").format(count=count)
```suggestion message = _("Removed {count} selfroles.").format(count=count) ```
@ -492,3 +510,4 @@
await ctx.send(message)
@commands.command()
@checks.is_owner()
Jackenmen (Migrated from github.com) commented 2021-09-01 19:02:49 +02:00
            message = _("Removed {count} selfroles.").format(count=count)
```suggestion message = _("Removed {count} selfroles.").format(count=count) ```
Jackenmen (Migrated from github.com) requested changes 2021-09-01 19:16:05 +02:00
Jackenmen (Migrated from github.com) left a comment

Just a few more things and this should be good to go.

Just a few more things and this should be good to go.
@ -450,45 +450,64 @@ class Admin(commands.Cog):
pass
Jackenmen (Migrated from github.com) commented 2021-09-01 19:13:24 +02:00

Copy-paste went wrong :)

        if count > 1:
            message = _("Added {count} selfroles.").format(count=count)
        else:
            message = _("Added 1 selfrole.")
Copy-paste went wrong :) ```suggestion if count > 1: message = _("Added {count} selfroles.").format(count=count) else: message = _("Added 1 selfrole.") ```
Jackenmen (Migrated from github.com) commented 2021-09-01 19:14:48 +02:00

This is already checked by the SelfRole converter

            current_selfroles.remove(role.id)
            count += 1
This is already checked by the `SelfRole` converter ```suggestion current_selfroles.remove(role.id) count += 1 ```
Jackenmen (Migrated from github.com) commented 2021-09-01 19:15:28 +02:00

This should be unnecessary, you can just use len(roles).

This should be unnecessary, you can just use `len(roles)`.
Jackenmen (Migrated from github.com) commented 2021-09-01 19:15:39 +02:00

This should be unnecessary, you can just use len(roles).

This should be unnecessary, you can just use `len(roles)`.
Jackenmen (Migrated from github.com) requested changes 2021-09-01 20:20:43 +02:00
@ -492,3 +510,4 @@
await ctx.send(message)
@commands.command()
@checks.is_owner()
Jackenmen (Migrated from github.com) commented 2021-09-01 20:20:39 +02:00

The hierarchy check still needs to stay, only the existence check is unneeded since SelfRole converter checks it already.

The hierarchy check still needs to stay, only the existence check is unneeded since `SelfRole` converter checks it already.
Jackenmen (Migrated from github.com) approved these changes 2021-09-02 00:37:27 +02:00
Jackenmen (Migrated from github.com) left a comment

Looks good to me, thanks!

Looks good to me, thanks! ![](https://i.fluffy.cc/qkNfpP0j2Ptdt9vDX2qq3NCXqdkcK6sS.gif)
red-githubbot[bot] commented 2021-09-08 21:55:11 +02:00 (Migrated from github.com)

Thanks Kreusada for the PR 🎉. I'm working now to backport this PR to: 3.4.

Thanks Kreusada for the PR 🎉. I'm working now to backport this PR to: 3.4.
red-githubbot[bot] commented 2021-09-08 21:55:18 +02:00 (Migrated from github.com)

#5278 is a backport of this pull request to Red 3.4.

#5278 is a backport of this pull request to [Red 3.4](https://github.com/Cog-Creators/Red-DiscordBot/tree/3.4).
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!5238
No description provided.