mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-04-20 16:00:29 +00:00
Fix pagination of huge command help messages (> ~2,000 chars)
Previously, calls to add_line in add_command_formatting of default help commands would fail if the command's help message would overflow the current page. This would also result in silent failure as the RuntimeError raised from add_line is never caught. This patch adds behavior that adds lines individually should it raise, which guarantees safe pagination as long as every line is smaller than the maximum page size, which is highly unlikely.
This commit is contained in:
parent
682c0d962f
commit
66af80511f
@ -889,7 +889,12 @@ class DefaultHelpCommand(HelpCommand):
|
||||
self.paginator.add_line(signature, empty=True)
|
||||
|
||||
if command.help:
|
||||
self.paginator.add_line(command.help, empty=True)
|
||||
try:
|
||||
self.paginator.add_line(command.help, empty=True)
|
||||
except RuntimeError:
|
||||
for line in command.help.splitlines():
|
||||
self.paginator.add_line(line)
|
||||
self.paginator.add_line()
|
||||
|
||||
def get_destination(self):
|
||||
ctx = self.context
|
||||
@ -1115,7 +1120,12 @@ class MinimalHelpCommand(HelpCommand):
|
||||
self.paginator.add_line(signature, empty=True)
|
||||
|
||||
if command.help:
|
||||
self.paginator.add_line(command.help, empty=True)
|
||||
try:
|
||||
self.paginator.add_line(command.help, empty=True)
|
||||
except RuntimeError:
|
||||
for line in command.help.splitlines():
|
||||
self.paginator.add_line(line)
|
||||
self.paginator.add_line()
|
||||
|
||||
def get_destination(self):
|
||||
ctx = self.context
|
||||
|
Loading…
x
Reference in New Issue
Block a user