Browse Source

Change default ellipsis descriptions to use U+2026

pull/7710/head
Rapptz 3 years ago
parent
commit
3c6daff473
  1. 12
      discord/app_commands/commands.py
  2. 2
      discord/app_commands/tree.py

12
discord/app_commands/commands.py

@ -129,7 +129,7 @@ CAMEL_CASE_REGEX = re.compile(r'(?<!^)(?=[A-Z])')
def _shorten( def _shorten(
input: str, input: str,
*, *,
_wrapper: TextWrapper = TextWrapper(width=100, max_lines=1, replace_whitespace=True, placeholder='...'), _wrapper: TextWrapper = TextWrapper(width=100, max_lines=1, replace_whitespace=True, placeholder=''),
) -> str: ) -> str:
return _wrapper.fill(' '.join(input.strip().split())) return _wrapper.fill(' '.join(input.strip().split()))
@ -201,7 +201,7 @@ def _populate_descriptions(params: Dict[str, CommandParameter], descriptions: Di
for name, param in params.items(): for name, param in params.items():
description = descriptions.pop(name, MISSING) description = descriptions.pop(name, MISSING)
if description is MISSING: if description is MISSING:
param.description = '...' param.description = ''
continue continue
if not isinstance(description, str): if not isinstance(description, str):
@ -291,7 +291,7 @@ def _extract_parameters_from_callback(func: Callable[..., Any], globalns: Dict[s
except AttributeError: except AttributeError:
for param in values: for param in values:
if param.description is MISSING: if param.description is MISSING:
param.description = '...' param.description = ''
else: else:
_populate_descriptions(result, descriptions) _populate_descriptions(result, descriptions)
@ -732,7 +732,7 @@ class Group:
if description is MISSING: if description is MISSING:
if cls.__doc__ is None: if cls.__doc__ is None:
cls.__discord_app_commands_group_description__ = '...' cls.__discord_app_commands_group_description__ = ''
else: else:
cls.__discord_app_commands_group_description__ = _shorten(cls.__doc__) cls.__discord_app_commands_group_description__ = _shorten(cls.__doc__)
else: else:
@ -955,7 +955,7 @@ class Group:
if description is MISSING: if description is MISSING:
if func.__doc__ is None: if func.__doc__ is None:
desc = '...' desc = ''
else: else:
desc = _shorten(func.__doc__) desc = _shorten(func.__doc__)
else: else:
@ -997,7 +997,7 @@ def command(
if description is MISSING: if description is MISSING:
if func.__doc__ is None: if func.__doc__ is None:
desc = '...' desc = ''
else: else:
desc = _shorten(func.__doc__) desc = _shorten(func.__doc__)
else: else:

2
discord/app_commands/tree.py

@ -760,7 +760,7 @@ class CommandTree(Generic[ClientT]):
if description is MISSING: if description is MISSING:
if func.__doc__ is None: if func.__doc__ is None:
desc = '...' desc = ''
else: else:
desc = _shorten(func.__doc__) desc = _shorten(func.__doc__)
else: else:

Loading…
Cancel
Save