mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-11-06 03:08:55 -05:00
Handle empty name case when splitting description field in help (#5941)
This commit is contained in:
parent
30dc128c39
commit
be5751a7ea
@ -398,13 +398,18 @@ class RedHelpFormatter(HelpFormatterABC):
|
|||||||
|
|
||||||
command_help = command.format_help_for_context(ctx)
|
command_help = command.format_help_for_context(ctx)
|
||||||
if command_help:
|
if command_help:
|
||||||
splitted = command_help.split("\n\n")
|
splitted = filter(None, command_help.split("\n\n"))
|
||||||
name = splitted[0]
|
try:
|
||||||
value = "\n\n".join(splitted[1:])
|
name = next(splitted)
|
||||||
if not value:
|
except StopIteration:
|
||||||
value = EMPTY_STRING
|
# all parts are empty
|
||||||
field = EmbedField(name[:250], value[:1024], False)
|
pass
|
||||||
emb["fields"].append(field)
|
else:
|
||||||
|
value = "\n\n".join(splitted)
|
||||||
|
if not value:
|
||||||
|
value = EMPTY_STRING
|
||||||
|
field = EmbedField(name[:250], value[:1024], False)
|
||||||
|
emb["fields"].append(field)
|
||||||
|
|
||||||
if subcommands:
|
if subcommands:
|
||||||
|
|
||||||
@ -571,13 +576,18 @@ class RedHelpFormatter(HelpFormatterABC):
|
|||||||
|
|
||||||
emb["footer"]["text"] = tagline
|
emb["footer"]["text"] = tagline
|
||||||
if description:
|
if description:
|
||||||
splitted = description.split("\n\n")
|
splitted = filter(None, description.split("\n\n"))
|
||||||
name = splitted[0]
|
try:
|
||||||
value = "\n\n".join(splitted[1:])
|
name = next(splitted)
|
||||||
if not value:
|
except StopIteration:
|
||||||
value = EMPTY_STRING
|
# all parts are empty
|
||||||
field = EmbedField(name[:252], value[:1024], False)
|
pass
|
||||||
emb["fields"].append(field)
|
else:
|
||||||
|
value = "\n\n".join(splitted)
|
||||||
|
if not value:
|
||||||
|
value = EMPTY_STRING
|
||||||
|
field = EmbedField(name[:252], value[:1024], False)
|
||||||
|
emb["fields"].append(field)
|
||||||
|
|
||||||
if coms:
|
if coms:
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user