Help command fix, normalize suggestions for unknown commands#1064
Merged
Conversation
Invalid subcommands are handlsend the user the help command of the parent command.
Bluenix2
reviewed
Jun 22, 2022
…into help_command_fix_863
brad90four
approved these changes
Jun 28, 2022
Contributor
brad90four
left a comment
There was a problem hiding this comment.
Content wise this looks good to me, have not verified with independent testing yet.
GDWR
previously requested changes
Jul 9, 2022
Contributor
GDWR
left a comment
There was a problem hiding this comment.
Looks good, just a slight type hint that could catch somebody out.
Contributor
|
I'm in the middle of a review (sorry for taking so long!) but I ran out of time to finish it today :/ I'll submit my review tomorrow. |
ichard26
requested changes
Jul 12, 2022
Contributor
ichard26
left a comment
There was a problem hiding this comment.
I wasn't able to find time to do a full review with manual testing (and I feel bad about delaying the PR even more), so consider this just a read-through review. On that note, it looks good except for a poorly written comment.
Co-authored-by: Richard Si <63936253+ichard26@users.noreply.github.com>
ichard26
approved these changes
Jul 14, 2022
wookie184
approved these changes
Aug 18, 2022
Contributor
wookie184
left a comment
There was a problem hiding this comment.
Had a quick look over, looks good and seems to work nicely, thanks 👍
2 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Relevant Issues
issue: #863
Refer to #884
Fixes
Changes
Providing an invalid subcommand but valid parent command (for example:
!ext listt, ext is valid but subcommandlisttis invalid) now sends the help command output for the parent command.Using
bot.all_commandsattribute instead ofbot.walk_commands()generator.walk_commands()is not useful in the error_handler because (as it provides us with all subcommands also), when there is an invalid subcommand, the parent command (commands.Group) handles this case and sends a help message, hence, never reaching the error_handler.all_commandsdoes not give us subcommands (it gives aliases which is pretty useful).Using
rapidfuzzfor finding similar commands instead ofdifflib(reasons being speed).Error handler now sends multiple command suggestions instead of 1 when user is trying to run an unknown command.
Yet to decide/to discuss
The help command lists/suggests commands that may not in the user's power to invoke them. Should we filter commands when listing them such that to only show them the commands which they can invoke ?
This is the current output when user invokes help command on a restricted command.
![Uploading image.png…]()
Did you: