Closed ghost closed 8 years ago
Welcome to GitHub and thanks for your PR! :octocat:
This is an issue that doesn't affect the reports and saylol commands only.
Probably the best solution to this issue – and to have DRY code – would be improving basecommands
so that it is aware of a commands' sub-commands, can parse the full command to figure out sub-commands and call distinct methods for them.
I'm sure there is a clean solution to this, I'm just not yet sure how it would look like. Especially since there could be multiple sub-commands and args in one command.
This would need some discussion and then an implementation, of course. Looking at @Dico200 since you implemented the commands decorator.
I'm not merging this PR as is, but I'll leave it open for discussion.
Ah ok, I see what your saying.
I have looked into a more advanced version of the simplecommand decorator multiple times, each time not finding a good implementation for it using python. The easiest and most straightforward way I can think of would be to add another argument to the decorator to add the information needed to filter the subcommands, so that you can assign a permission to those that should see everything, and the others will only see the subcommands that can be used by non-staff basically.
Unfortunately, at the moment that alone would require more changes as a list of subcommands isn't submitted, only a custom String which explains the usage of the command, and will manually have the subcommands in it.
I was thinking of a good sub-command and permission managing system and came up with a little idea, will try to code it tomorrow (as 15-08-2015). Hopefully it turns out good, it will probably be a replacement for simplecommand according to my plans of using a class for it... but we could make some work-arounds.
@NEMESIS13cz I looked into that before but never continued upon that implementation because I consider our current setup to be really clean, and I can't really say that about classes. It's not really what classes are meant to do anyway and thus likely a bit less efficient as well.
I do not wish to discourage you trying to code that idea of yours though, I'd love to see what you come up with ^^
How about we only show in help dialogues the commands you actually have the permissions to use.