mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-04-20 16:00:29 +00:00
[commands] Pass failed argument's value to BadLiteralArgument
This commit is contained in:
parent
78099992dd
commit
a938b10e5a
@ -1330,7 +1330,7 @@ async def run_converters(ctx: Context[BotT], converter: Any, argument: str, para
|
||||
return value
|
||||
|
||||
# if we're here, then we failed to match all the literals
|
||||
raise BadLiteralArgument(param, literal_args, errors)
|
||||
raise BadLiteralArgument(param, literal_args, errors, argument)
|
||||
|
||||
# This must be the last if-clause in the chain of origin checking
|
||||
# Nearly every type is a generic type within the typing library
|
||||
|
@ -920,12 +920,17 @@ class BadLiteralArgument(UserInputError):
|
||||
A tuple of values compared against in conversion, in order of failure.
|
||||
errors: List[:class:`CommandError`]
|
||||
A list of errors that were caught from failing the conversion.
|
||||
argument: :class:`str`
|
||||
The argument's value that failed to be converted. Defaults to an empty string.
|
||||
|
||||
.. versionadded:: 2.3
|
||||
"""
|
||||
|
||||
def __init__(self, param: Parameter, literals: Tuple[Any, ...], errors: List[CommandError]) -> None:
|
||||
def __init__(self, param: Parameter, literals: Tuple[Any, ...], errors: List[CommandError], argument: str = "") -> None:
|
||||
self.param: Parameter = param
|
||||
self.literals: Tuple[Any, ...] = literals
|
||||
self.errors: List[CommandError] = errors
|
||||
self.argument: str = argument
|
||||
|
||||
to_string = [repr(l) for l in literals]
|
||||
if len(to_string) > 2:
|
||||
|
Loading…
x
Reference in New Issue
Block a user