JDA-Utilities icon indicating copy to clipboard operation
JDA-Utilities copied to clipboard

requiredRole

Open b-ncMN opened this issue 4 years ago • 6 comments

Suggestion

Add a way to set multiple requiredRole when creating a command.

b-ncMN avatar Oct 15 '19 19:10 b-ncMN

Yeah, CommandBuilder#setRequiredRoles(String...) or CommandBuilder#setRequiredRoles(Role...) sounds like a good idea. Why not considering making a PR for that? It is kinda a breaking change so better wait for jag or somebody to confirm that tho.

DManstrator avatar Oct 15 '19 19:10 DManstrator

The concept of a required role is a very basic one; if you need more fine-tuned permissions, I would recommend writing your specifically-needed permissions checks into a Category.

jagrosh avatar Oct 15 '19 20:10 jagrosh

Yeah it's what I have done, I even started to write that in the API, I can pull request you if you want.

b-ncMN avatar Oct 15 '19 21:10 b-ncMN

I don't really think it would be good to replace the base system we have now because it would be confusing whether a user was required to have all of the required roles or any of the required roles.

jagrosh avatar Oct 15 '19 21:10 jagrosh

Oh yeah, I did not thinked about that, well, personally it's more convenient to check if the user have any of the roles. And why not just creating both of them and commenting them to describe to avoid that to happen ?

b-ncMN avatar Oct 15 '19 21:10 b-ncMN

might as well just throw in an enum CommandBuilder#setRequiredRoles(RequiredRole role, String...)

where options are RequiredRole.ANY RequiredRole.ALL

HazirBot avatar Oct 16 '19 16:10 HazirBot