diff --git a/docs/cog_guides/core.rst b/docs/cog_guides/core.rst index 69e1895494f..71bc5113dc8 100644 --- a/docs/cog_guides/core.rst +++ b/docs/cog_guides/core.rst @@ -1475,9 +1475,6 @@ helpset maxpages 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. @@ -4378,4 +4375,4 @@ uptime **Description** -Shows Red's uptime. \ No newline at end of file +Shows Red's uptime. diff --git a/redbot/core/commands/help.py b/redbot/core/commands/help.py index dcff3f0410e..66920780d59 100644 --- 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 index 944e9ff059e..1b780b1ff7d 100644 --- 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.