diff options
| author | Rapptz <[email protected]> | 2021-04-11 16:30:28 -0400 |
|---|---|---|
| committer | Rapptz <[email protected]> | 2021-04-11 16:30:28 -0400 |
| commit | 74b07a3218a3e3ba12a4cb52093f94b16c3a0e89 (patch) | |
| tree | 7ddaa51f680e67a76db81c90479de103183acc9d /discord/ext | |
| parent | [commands] Strip text to remove spaces before ellipsis (diff) | |
| download | discord.py-74b07a3218a3e3ba12a4cb52093f94b16c3a0e89.tar.xz discord.py-74b07a3218a3e3ba12a4cb52093f94b16c3a0e89.zip | |
[commands] Fix Command.clean_params to return a regular dict
Diffstat (limited to 'discord/ext')
| -rw-r--r-- | discord/ext/commands/core.py | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/discord/ext/commands/core.py b/discord/ext/commands/core.py index 7b54717f..acd7898f 100644 --- a/discord/ext/commands/core.py +++ b/discord/ext/commands/core.py @@ -693,22 +693,25 @@ class Command(_BaseCommand): return value @property - def clean_params(self): - """OrderedDict[:class:`str`, :class:`inspect.Parameter`]: - Retrieves the parameter OrderedDict without the context or self parameters. + def clean_params(self) -> Dict[str, inspect.Parameter]: + """Dict[:class:`str`, :class:`inspect.Parameter`]: + Retrieves the parameter dictionary without the context or self parameters. Useful for inspecting signature. """ result = self.params.copy() if self.cog is not None: # first parameter is self - result.popitem(last=False) + try: + del result[next(iter(result))] + except StopIteration: + raise ValueError("missing 'self' parameter") from None try: # first/second parameter is context - result.popitem(last=False) - except Exception: - raise ValueError('Missing context parameter') from None + del result[next(iter(result))] + except StopIteration: + raise ValueError("missing 'context' parameter") from None return result |