mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-11-06 11:18:54 -05:00
[Help] Detatch menu usage into a task (#2725)
* [Help] Detatch menu usage into a task - This resolves #2712 - This is a minor API change. Conceptually, the difference is minor in nature `bot.send_help_for` returns when help has been sent, however this can now be prior to when the help menu (if one is in use) is closed. - This should not be considered breaking as there is and has been a a warning about this file's APIs being still up for unannounced modifications No developers should be currently relying on this behavior. * operator precendence
This commit is contained in:
parent
0e9086ca1f
commit
33b7652b62
@ -26,6 +26,7 @@
|
|||||||
# Additionally, this gives our users a bit more customization options including by
|
# Additionally, this gives our users a bit more customization options including by
|
||||||
# 3rd party cogs down the road.
|
# 3rd party cogs down the road.
|
||||||
|
|
||||||
|
import asyncio
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
from typing import Union, List, AsyncIterator, Iterable, cast
|
from typing import Union, List, AsyncIterator, Iterable, cast
|
||||||
|
|
||||||
@ -555,10 +556,13 @@ class RedHelpFormatter:
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
if len(pages) > 1:
|
# Specifically ensuring the menu's message is sent prior to returning
|
||||||
await menus.menu(ctx, pages, menus.DEFAULT_CONTROLS)
|
m = await (ctx.send(embed=pages[0]) if embed else ctx.send(pages[0]))
|
||||||
else:
|
c = menus.DEFAULT_CONTROLS if len(pages) > 1 else {"\N{CROSS MARK}": menus.close_menu}
|
||||||
await menus.menu(ctx, pages, {"\N{CROSS MARK}": menus.close_menu})
|
# Allow other things to happen during menu timeout/interaction.
|
||||||
|
asyncio.create_task(menus.menu(ctx, pages, c, message=m))
|
||||||
|
# menu needs reactions added manually since we fed it a messsage
|
||||||
|
menus.start_adding_reactions(m, c.keys())
|
||||||
|
|
||||||
|
|
||||||
@commands.command(name="help", hidden=True, i18n=T_)
|
@commands.command(name="help", hidden=True, i18n=T_)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user