Browse Source
[commands] fix signature when displayed_default is missing
This makes it so that passing an empty string (or MISSING) to the
displayed_default of commands.Parameter not show up as [name=] or [name=...]
pull/7974/head
Varun J
3 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
1 additions and
2 deletions
-
discord/ext/commands/core.py
|
@ -1115,8 +1115,7 @@ class Command(_BaseCommand, Generic[CogT, P, T]): |
|
|
if not param.required: |
|
|
if not param.required: |
|
|
# We don't want None or '' to trigger the [name=value] case and instead it should |
|
|
# We don't want None or '' to trigger the [name=value] case and instead it should |
|
|
# do [name] since [name=None] or [name=] are not exactly useful for the user. |
|
|
# do [name] since [name=None] or [name=] are not exactly useful for the user. |
|
|
should_print = param.default if isinstance(param.default, str) else param.default is not None |
|
|
if param.displayed_default: |
|
|
if should_print: |
|
|
|
|
|
result.append( |
|
|
result.append( |
|
|
f'[{name}={param.displayed_default}]' if not greedy else f'[{name}={param.displayed_default}]...' |
|
|
f'[{name}={param.displayed_default}]' if not greedy else f'[{name}={param.displayed_default}]...' |
|
|
) |
|
|
) |
|
|