Add user param to menu() (#4913)

Co-authored-by: jack1142 <6032823+jack1142@users.noreply.github.com>
Co-authored-by: Jakub Kuczys <me@jacken.men>
This commit is contained in:
Auguste Charpentier
2024-03-18 01:35:53 +01:00
committed by GitHub
parent 4c7a691ec9
commit 8c2976504a
3 changed files with 158 additions and 28 deletions

View File

@@ -878,14 +878,10 @@ class RedHelpFormatter(HelpFormatterABC):
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(menu_ctx, pages, c, message=m, timeout=help_settings.react_timeout)
menus.menu(
ctx, pages, c, user=ctx.author, 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())