From 40c37b5c06085bbdacb26c88c446904fdeb5dc66 Mon Sep 17 00:00:00 2001 From: James Date: Tue, 6 Mar 2018 12:10:56 +1300 Subject: [PATCH] [V3 Help][ fix help_formatter to obey length limits (#1375) Help didn't account for docstrings passing length limits which I noticed a while ago and as noticed again when Palm forgot a dual newline in a command docstring. This PR sees to fix this by enforcing length limits on description, field names and field values --- redbot/core/help_formatter.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/redbot/core/help_formatter.py b/redbot/core/help_formatter.py index 9d9180105..3d6be7e7e 100644 --- a/redbot/core/help_formatter.py +++ b/redbot/core/help_formatter.py @@ -139,7 +139,7 @@ class Help(formatter.HelpFormatter): if description: # portion - emb['embed']['description'] = description + emb['embed']['description'] = description[:2046] if isinstance(self.command, discord.ext.commands.core.Command): # @@ -149,11 +149,11 @@ class Help(formatter.HelpFormatter): # section if self.command.help: name = '__{0}__'.format(self.command.help.split('\n\n')[0]) - name_length = len(name) - 4 + name_length = len(name) value = self.command.help[name_length:].replace('[p]', self.clean_prefix) if value == '': value = EMPTY_STRING - field = EmbedField(name, value, False) + field = EmbedField(name[:252], value[:1024], False) emb['fields'].append(field) # end it here if it's just a regular command