mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-11-06 11:18:54 -05:00
[Help] Strip docstrings before shortening them (#4983)
* [Help] Strip docstrings before shortening them * [Help] Use rstrip instead of full strip
This commit is contained in:
parent
53276ea12a
commit
606c2f50ba
@ -380,7 +380,7 @@ class RedHelpFormatter(HelpFormatterABC):
|
||||
def shorten_line(a_line: str) -> str:
|
||||
if len(a_line) < 70: # embed max width needs to be lower
|
||||
return a_line
|
||||
return a_line[:67] + "..."
|
||||
return a_line[:67].rstrip() + "..."
|
||||
|
||||
subtext = "\n".join(
|
||||
shorten_line(f"**{name}** {command.format_shortdoc_for_context(ctx)}")
|
||||
@ -410,7 +410,7 @@ class RedHelpFormatter(HelpFormatterABC):
|
||||
width_gap = discord.utils._string_width(nm) - len(nm)
|
||||
doc = com.format_shortdoc_for_context(ctx)
|
||||
if len(doc) > doc_max_width:
|
||||
doc = doc[: doc_max_width - 3] + "..."
|
||||
doc = doc[: doc_max_width - 3].rstrip() + "..."
|
||||
yield nm, doc, max_width - width_gap
|
||||
|
||||
subtext = "\n".join(
|
||||
@ -555,7 +555,7 @@ class RedHelpFormatter(HelpFormatterABC):
|
||||
def shorten_line(a_line: str) -> str:
|
||||
if len(a_line) < 70: # embed max width needs to be lower
|
||||
return a_line
|
||||
return a_line[:67] + "..."
|
||||
return a_line[:67].rstrip() + "..."
|
||||
|
||||
command_text = "\n".join(
|
||||
shorten_line(f"**{name}** {command.format_shortdoc_for_context(ctx)}")
|
||||
@ -584,7 +584,7 @@ class RedHelpFormatter(HelpFormatterABC):
|
||||
width_gap = discord.utils._string_width(nm) - len(nm)
|
||||
doc = com.format_shortdoc_for_context(ctx)
|
||||
if len(doc) > doc_max_width:
|
||||
doc = doc[: doc_max_width - 3] + "..."
|
||||
doc = doc[: doc_max_width - 3].rstrip() + "..."
|
||||
yield nm, doc, max_width - width_gap
|
||||
|
||||
subtext = "\n".join(
|
||||
@ -622,7 +622,7 @@ class RedHelpFormatter(HelpFormatterABC):
|
||||
def shorten_line(a_line: str) -> str:
|
||||
if len(a_line) < 70: # embed max width needs to be lower
|
||||
return a_line
|
||||
return a_line[:67] + "..."
|
||||
return a_line[:67].rstrip() + "..."
|
||||
|
||||
cog_text = "\n".join(
|
||||
shorten_line(f"**{name}** {command.format_shortdoc_for_context(ctx)}")
|
||||
@ -655,7 +655,7 @@ class RedHelpFormatter(HelpFormatterABC):
|
||||
width_gap = discord.utils._string_width(nm) - len(nm)
|
||||
doc = com.format_shortdoc_for_context(ctx)
|
||||
if len(doc) > doc_max_width:
|
||||
doc = doc[: doc_max_width - 3] + "..."
|
||||
doc = doc[: doc_max_width - 3].rstrip() + "..."
|
||||
yield nm, doc, max_width - width_gap
|
||||
|
||||
for cog_name, data in coms:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user