Make help dialogue only show commands you have perms to #23

Closed
ghost wants to merge 3 commits from mergeable-changes into dev
ghost commented 2015-08-14 15:35:20 +00:00 (Migrated from github.com)

How about we only show in help dialogues the commands you actually have the permissions to use.

How about we only show in help dialogues the commands you actually have the permissions to use.
jomo commented 2015-08-14 16:30:07 +00:00 (Migrated from github.com)

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.

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`](https://github.com/RedstonerServer/redstoner-utils/blob/2310c9143ad81515de28c88adde0d175266bbb72/basecommands.py) 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.
ghost commented 2015-08-14 17:01:02 +00:00 (Migrated from github.com)

Ah ok, I see what your saying.

Ah ok, I see what your saying.
Dico200 commented 2015-08-15 01:41:56 +00:00 (Migrated from github.com)

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.

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.
Dico200 commented 2015-08-15 01:44:25 +00:00 (Migrated from github.com)

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.

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.
Nemezor commented 2015-08-15 01:44:31 +00:00 (Migrated from github.com)

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.

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.
Dico200 commented 2015-08-15 01:46:42 +00:00 (Migrated from github.com)

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

@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.
Dico200 commented 2015-08-15 01:47:34 +00:00 (Migrated from github.com)

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 ^^

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 ^^
This repo is archived. You cannot comment on pull requests.
No reviewers
No Milestone
No Assignees
1 Participants
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: Redstoner/redstoner-utils#23
No description provided.