-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix UserInputError being handled incorrectly. #77
Conversation
Thanks. Could you also capitalize the description, so it doesn’t start with a lowercase letter? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@gustavwilliam you might want to look at this. @codephile1221 Thanks for noticing the bug
f"Your input was invalid: {error}\n\nUsage:\n" | ||
f"```{ctx.prefix}{ctx.command} {ctx.command.signature}```" | ||
) | ||
if isinstance(error, commands.MissingRequiredArgument): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So if there is a MissingRequiredArgument happens, this bug occurs? nice catch 💯
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So if there is a MissingRequiredArgument happens, this bug occurs? nice catch 100
Actually, this bug occurs if any UserInputError
happens (including MissingRequriedArgument
).
I added special handling of MissingRequiredArgument
just so that the message is different.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! Looks Good To Me!
In future we could do something like this:
def error_handler():
if userinputerror:
handle_user_input_error()
elif checkserror:
handle_checkst_error():
... others
def handle_user_input_error():
"""
* MissingRequiredArgument
* TooManyArguments
* BadArgument
* ArgumentParsingError
"""
def handle_checkst_error():
"""
* BotMissingPermissions
* BotMissingRole
* NoPrivateMessage
"""
... etc.
Yeah, I thought of that. I think rather than capitalizing, formatting the parameter ( Or, we could alter the entire sentence structure. There are two ways this can be carried out.
Both are easy to implement. |
This method is to be removed after A default embed helper function #30
title = title or random.choice(ERROR_REPLIES) | ||
embed = Embed(colour=Colours.soft_red, title=title) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This part will be removed anyway after issue #30. However, VS Code was bothering me and I changed it.
Yeah that looks better. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks!
Can we merge this as it is a high priority feature? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@Shivansh-007 Well, yeah, it's currently one of the most important features on gurkbot, but it's not per say a high priority feature. We have a label for that, and this one does not warrant it. |
UserInputError
has been made part of theif-elif
block.This should fix issue #76.
Additionally,
MissingRequiredArgument
now shows a different message.old:
now: