Handle responding to interactions in help formatter for hybrids (#6724)

Co-authored-by: Jakub Kuczys <me@jacken.men>
This commit is contained in:
Evanroby
2026-05-23 08:25:14 +02:00
committed by GitHub
parent f72346e993
commit af4101f1dc
+9 -4
View File
@@ -872,7 +872,7 @@ class RedHelpFormatter(HelpFormatterABC):
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
destination = ctx.author if use_DMs and ctx.interaction is None else ctx
# Specifically ensuring the menu's message is sent prior to returning
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}
@@ -892,12 +892,13 @@ class RedHelpFormatter(HelpFormatterABC):
delete_delay = help_settings.delete_delay
messages: List[discord.Message] = []
page_destination = ctx if ctx.interaction and not use_DMs else destination
for page in pages:
try:
if embed:
msg = await destination.send(embed=page)
msg = await page_destination.send(embed=page)
else:
msg = await destination.send(page)
msg = await page_destination.send(page)
except discord.Forbidden:
return await ctx.send(
_(
@@ -907,7 +908,11 @@ class RedHelpFormatter(HelpFormatterABC):
)
else:
messages.append(msg)
if use_DMs and help_settings.use_tick:
page_destination = destination
if use_DMs:
if ctx.interaction:
await ctx.send(_("I have sent the help message to your DMs."), ephemeral=True)
elif help_settings.use_tick:
await ctx.tick()
# The if statement takes into account that 'destination' will be
# the context channel in non-DM context.