Repository: Cog-Creators/Red-DiscordBot

Issue:
Allowing Help to be DMable when Menu is toggled.
### Type of feature request

Other

### Description of the feature you're suggesting

As stated in the Title when using the menu system which is enabled via [p]helpset usemenus 

It now uses help in the chat you used it, I think a good feature would be being able to toggle this so people dont flood the chat with help commands if they want to look at the command list!

Thank you in advance!

### Anything else?

_No response_


Discussion:

Resolving patch:
diff --git a/redbot/core/commands/help.py b/redbot/core/commands/help.py
--- a/redbot/core/commands/help.py
+++ b/redbot/core/commands/help.py
@@ -856,23 +856,36 @@ async def send_pages(
         if help_settings.use_menus.value >= HelpMenuSetting.buttons.value:
             use_select = help_settings.use_menus.value == 3
             select_only = help_settings.use_menus.value == 4
-            await SimpleMenu(
+            menu = SimpleMenu(
                 pages,
                 timeout=help_settings.react_timeout,
                 use_select_menu=use_select,
                 use_select_only=select_only,
-            ).start(ctx)
+            )
+            # Send menu to DMs if max pages is 0
+            if help_settings.max_pages_in_guild == 0:
+                await menu.start_dm(ctx.author)
+            else:
+                await menu.start(ctx)
 
         elif (
             can_user_react_in(ctx.me, ctx.channel)
             and help_settings.use_menus is HelpMenuSetting.reactions
         ):
+            use_DMs = help_settings.max_pages_in_guild == 0
+            destination = ctx.author if use_DMs else ctx.channel
             # Specifically ensuring the menu's message is sent prior to returning
-            m = await (ctx.send(embed=pages[0]) if embed else ctx.send(pages[0]))
+            m = await (destination.send(embed=pages[0]) if embed else destination.send(pages[0]))
             c = menus.DEFAULT_CONTROLS if len(pages) > 1 else {"\N{CROSS MARK}": menus.close_menu}
             # Allow other things to happen during menu timeout/interaction.
+            if use_DMs:
+                menu_ctx = await ctx.bot.get_context(m)
+                # Monkeypatch so help listens for reactions from the original author, not the bot
+                menu_ctx.author = ctx.author
+            else:
+                menu_ctx = ctx
             asyncio.create_task(
-                menus.menu(ctx, pages, c, message=m, timeout=help_settings.react_timeout)
+                menus.menu(menu_ctx, pages, c, message=m, timeout=help_settings.react_timeout)
             )
             # menu needs reactions added manually since we fed it a message
             menus.start_adding_reactions(m, c.keys())
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
@@ -4446,8 +4446,6 @@ async def helpset_pagecharlimt(self, ctx: commands.Context, limit: int):
     async def helpset_maxpages(self, ctx: commands.Context, pages: int):
         """Set the maximum number of help pages sent in a server channel.
 
-        Note: This setting does not apply to menu 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.


Test patch: