Make selfrole case insensitive #3853

Closed
opened 2020-05-17 14:26:06 +02:00 by RheingoldRiver · 10 comments
RheingoldRiver commented 2020-05-17 14:26:06 +02:00 (Migrated from github.com)

Feature request

Select the type of feature you are requesting:

  • Cog
  • Command
  • API functionality

Describe your requested feature

In Admin cog, could selfrole be made case insensitive? In the event that a server has two separate roles that are both allowed in selfrole, it could print a warning about the situation every time a role is added or removed via selfrole.

# Feature request #### Select the type of feature you are requesting: - [x] Cog - [ ] Command - [ ] API functionality #### Describe your requested feature In Admin cog, could selfrole be made case insensitive? In the event that a server has two separate roles that are both allowed in selfrole, it could print a warning about the situation every time a role is added or removed via selfrole.
Drapersniper commented 2020-05-17 14:34:29 +02:00 (Migrated from github.com)

I think it is more appropriate to be explicit here when performind moredation actions ( giving a role) to members. but this is just my personal opinion.

I think it is more appropriate to be explicit here when performind moredation actions ( giving a role) to members. but this is just my personal opinion.
RheingoldRiver commented 2020-05-17 14:37:15 +02:00 (Migrated from github.com)

my users are unable to figure out how to assign themselves roles because it's case-sensitive. I realize how ridiculous that sounds, but it's a huge usability problem in my server. I suppose I could just make all role names lowercase, but that makes my server look lazy/sloppily set-up, and it's supposed to be an official support server.

Maybe case sensitivity could be toggled?

my users are unable to figure out how to assign themselves roles because it's case-sensitive. I realize how ridiculous that sounds, but it's a huge usability problem in my server. I suppose I could just make all role names lowercase, but that makes my server look lazy/sloppily set-up, and it's supposed to be an official support server. Maybe case sensitivity could be toggled?
Jackenmen commented 2020-05-17 14:43:11 +02:00 (Migrated from github.com)

I think this wouldn't be a bad idea, assuming only [p]selfrole add/remove would be affected and you would still have to use proper casing when adding/removing role from available selfroles with [p]selfroleset. Once role is added with [p]selfroleset, its ID is saved in config so users would have the proper role assigned no matter the casing that they used.

I'm marking this as "Needs discussion" until another org member gives their opinion

I think this wouldn't be a bad idea, assuming only `[p]selfrole add/remove` would be affected and you would still have to use proper casing when adding/removing role from available selfroles with `[p]selfroleset`. Once role is added with `[p]selfroleset`, its ID is saved in config so users would have the proper role assigned no matter the casing that they used. I'm marking this as "Needs discussion" until another org member gives their opinion
Dav-Git commented 2020-05-17 14:45:12 +02:00 (Migrated from github.com)

If I may chip in, what happens if the role "James" and "james" are both set to self-assignable and a user runs [p]selfrole add james

If I may chip in, what happens if the role "James" and "james" are both set to self-assignable and a user runs ``[p]selfrole add james``
RheingoldRiver commented 2020-05-17 14:47:46 +02:00 (Migrated from github.com)

In that case I would add james and print a warning along with the confirmation - "Added role james. Please note that the role[s] James[, and JameS] is[are] also available. You may use ^selfrole remove and ^selfrole add if needed." or something along those lines

If there are multiple casings available and you try to assign one that doesn't match any of them, it could either error or guess and print a similar warning. I think this is enough of an edge case (and already a terrible practice haha) that it's not a big tradeoff to somewhat sacrifice ease of use in this case.

In that case I would add james and print a warning along with the confirmation - "Added role `james`. Please note that the role[s] `James`[, and JameS] is[are] also available. You may use `^selfrole remove` and `^selfrole add` if needed." or something along those lines If there are multiple casings available and you try to assign one that doesn't match any of them, it could either error or guess and print a similar warning. I think this is enough of an edge case (and already a terrible practice haha) that it's not a big tradeoff to somewhat sacrifice ease of use in this case.
Dav-Git commented 2020-05-17 14:52:18 +02:00 (Migrated from github.com)

In that case I would say it would be best to check role.name.lower() and don't allow 2 roles with a similar name with just different casing to be made self-assignable at the same time.

In that case I would say it would be best to check role.name.lower() and don't allow 2 roles with a similar name with just different casing to be made self-assignable at the same time.
RheingoldRiver commented 2020-05-17 14:53:09 +02:00 (Migrated from github.com)

ah yeah, that probably makes more sense

ah yeah, that probably makes more sense
Flame442 commented 2020-05-17 21:49:19 +02:00 (Migrated from github.com)

don't allow 2 roles with a similar name with just different casing to be made self-assignable at the same time.

I'm not sure quite how that would work since role names can be changed...
You can technically break this right now if you have two roles with the exact same (case sensitive) name. It will only allow you to assign one of them, saying the role was already assigned if you have one of the two. You are able to use the ID, but must users won't know to do that.

> don't allow 2 roles with a similar name with just different casing to be made self-assignable at the same time. I'm not sure *quite* how that would work since role names can be changed... You can technically break this right now if you have two roles with the exact same (case sensitive) name. It will only allow you to assign one of them, saying the role was already assigned if you have one of the two. You *are* able to use the ID, but must users won't know to do that.
Drapersniper commented 2020-05-17 21:55:54 +02:00 (Migrated from github.com)

We could ... do a menu picker for when a prompt matches multiple roles, in the realworld chances are that this won't be the case much, but outside of straight up saying "unable to give you role, currently multiple roles share this name" can't think of anything else we could do

We could ... do a menu picker for when a prompt matches multiple roles, in the realworld chances are that this won't be the case much, but outside of straight up saying "unable to give you role, currently multiple roles share this name" can't think of anything else we could do
RheingoldRiver commented 2020-05-18 03:53:38 +02:00 (Migrated from github.com)

well it could give you the role you exact-matched if you did, and if not then say "sorry unable to determine"

If James and james exist ->

  • selfrole James -> you get James
  • selfrole james -> you get james
  • selfrole JaMeS -> error
well it could give you the role you exact-matched if you did, and if not then say "sorry unable to determine" If `James` and `james` exist -> * selfrole James -> you get James * selfrole james -> you get james * selfrole JaMeS -> error
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#3853
No description provided.