[commands] Fix Command.clean_params to return a regular dict
This commit is contained in:
parent
af5964358d
commit
74b07a3218
@ -693,22 +693,25 @@ class Command(_BaseCommand):
|
|||||||
return value
|
return value
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def clean_params(self):
|
def clean_params(self) -> Dict[str, inspect.Parameter]:
|
||||||
"""OrderedDict[:class:`str`, :class:`inspect.Parameter`]:
|
"""Dict[:class:`str`, :class:`inspect.Parameter`]:
|
||||||
Retrieves the parameter OrderedDict without the context or self parameters.
|
Retrieves the parameter dictionary without the context or self parameters.
|
||||||
|
|
||||||
Useful for inspecting signature.
|
Useful for inspecting signature.
|
||||||
"""
|
"""
|
||||||
result = self.params.copy()
|
result = self.params.copy()
|
||||||
if self.cog is not None:
|
if self.cog is not None:
|
||||||
# first parameter is self
|
# first parameter is self
|
||||||
result.popitem(last=False)
|
try:
|
||||||
|
del result[next(iter(result))]
|
||||||
|
except StopIteration:
|
||||||
|
raise ValueError("missing 'self' parameter") from None
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# first/second parameter is context
|
# first/second parameter is context
|
||||||
result.popitem(last=False)
|
del result[next(iter(result))]
|
||||||
except Exception:
|
except StopIteration:
|
||||||
raise ValueError('Missing context parameter') from None
|
raise ValueError("missing 'context' parameter") from None
|
||||||
|
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user