Repository: Cog-Creators/Red-DiscordBot

Issue:
[V3 Core] Increase the maximum amount of characters in a single help message
### Type:

- [X] Suggestion
- [ ] Bug

### Brief description of the problem
Currently, the maximum amount of characters allowed in all fields combined in a single help embed is 1000. [See this code](https://github.com/Cog-Creators/Red-DiscordBot/blob/V3/develop/redbot/core/help_formatter.py#L193).

I think this is way too little and causes the bot to split `[p]help` into multiple messages much too quickly. Instead, I think the limit should be increased to something like 2000. 
Technically, the maximum amount of characters a rich embed can have is 6000, but I can understand that it's not desirable for the embeds to be *that* big (especially when taking mobile users into consideration).
On the contrary, I think a limit of 1000 makes the bot unnecessarily split the fields too quickly. 2000 is a nice middle ground between the two.

TL;DR - Increase the limit of 1000 chars per help embed to something like 2000 chars per help embed.



Discussion:
Hi, thanks for the suggestion!

We are going to stick with a default of 1000, but we realise this doesn't suit everyone. So, we plan on resolving this by adding a global setting for the character limit per page, and also the number of pages needed before the help message is sent in a DM.

The interface for these setting will be done in a new `[p]helpset` command, as suggested in #1605.

Resolving patch:
diff --git a/redbot/core/bot.py b/redbot/core/bot.py
--- a/redbot/core/bot.py
+++ b/redbot/core/bot.py
@@ -49,6 +49,8 @@ def __init__(self, cli_flags, bot_dir: Path = Path.cwd(), **kwargs):
             enable_sentry=None,
             locale="en",
             embeds=True,
+            help__page_char_limit=1000,
+            help__max_pages_in_guild=2,
         )
 
         self.db.register_guild(
diff --git a/redbot/core/core_commands.py b/redbot/core/core_commands.py
--- a/redbot/core/core_commands.py
+++ b/redbot/core/core_commands.py
@@ -831,6 +831,51 @@ async def sentry(self, ctx: commands.Context, on_or_off: bool):
             ctx.bot.disable_sentry()
             await ctx.send(_("Done. Sentry logging is now disabled."))
 
+    @commands.group()
+    @checks.is_owner()
+    async def helpset(self, ctx: commands.Context):
+        """Manage settings for the help command."""
+        if ctx.invoked_subcommand is None:
+            await ctx.send_help()
+
+    @helpset.command(name="pagecharlimit")
+    async def helpset_pagecharlimt(self, ctx: commands.Context, limit: int):
+        """Set the character limit for each page in the help message.
+
+        This setting only applies to embedded help.
+
+        Please note that setting a relitavely small character limit may
+        mean some pages will exceed this limit. This is because categories
+        are never spread across multiple pages in the help message.
+
+        The default value is 1000 characters.
+        """
+        if limit <= 0:
+            await ctx.send(_("You must give a positive value!"))
+            return
+
+        await ctx.bot.db.help.page_char_limit.set(limit)
+        await ctx.send(_("Done. The character limit per page has been set to {}.").format(limit))
+
+    @helpset.command(name="maxpages")
+    async def helpset_maxpages(self, ctx: commands.Context, pages: int):
+        """Set the maximum number of help pages sent in a server channel.
+
+        This setting only applies to embedded help.
+
+        If a help message contains more pages than this value, the help message will
+        be sent to the command author via DM. This is to help reduce spam in server
+        text channels.
+
+        The default value is 2 pages.
+        """
+        if pages < 0:
+            await ctx.send(_("You must give a value of zero or greater!"))
+            return
+
+        await ctx.bot.db.help.max_pages_in_guild.set(pages)
+        await ctx.send(_("Done. The page limit has been set to {}.").format(pages))
+
     @commands.command()
     @checks.is_owner()
     async def listlocales(self, ctx: commands.Context):
diff --git a/redbot/core/help_formatter.py b/redbot/core/help_formatter.py
--- a/redbot/core/help_formatter.py
+++ b/redbot/core/help_formatter.py
@@ -236,7 +236,9 @@ async def format_help_for(self, ctx, command_or_bot, reason: str = None):
             emb["embed"]["title"] = "{0}".format(reason)
 
         ret = []
-        field_groups = self.group_fields(emb["fields"])
+
+        page_char_limit = await ctx.bot.db.help.page_char_limit()
+        field_groups = self.group_fields(emb["fields"], page_char_limit)
 
         for i, group in enumerate(field_groups, 1):
             embed = discord.Embed(color=self.color, **emb["embed"])
@@ -360,7 +362,8 @@ def repl(obj):
         else:
             embeds = await f.format_help_for(ctx, command)
 
-    if len(embeds) > 2:
+    max_pages_in_guild = await ctx.bot.db.help.max_pages_in_guild()
+    if len(embeds) > max_pages_in_guild:
         destination = ctx.author
 
     for embed in embeds:


Test patch: