mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-12-08 18:32:32 -05:00
Switch from low-level loop.create_task and asyncio.ensure_future (#5626)
* Switch from low-level loop.create_task and asyncio.ensure_future * Patch vendored discord.ext.menus to use modern APIs as well That ext is no longer maintained by Danny anyway so... * black
This commit is contained in:
@@ -1082,7 +1082,7 @@ class Red(
|
||||
if any(LIB_PATH.iterdir()):
|
||||
shutil.rmtree(str(LIB_PATH))
|
||||
LIB_PATH.mkdir()
|
||||
self.loop.create_task(
|
||||
asyncio.create_task(
|
||||
send_to_owners_with_prefix_replaced(
|
||||
self,
|
||||
"We detected a change in minor Python version"
|
||||
@@ -1117,7 +1117,7 @@ class Red(
|
||||
system_changed = True
|
||||
|
||||
if system_changed and not python_version_changed:
|
||||
self.loop.create_task(
|
||||
asyncio.create_task(
|
||||
send_to_owners_with_prefix_replaced(
|
||||
self,
|
||||
"We detected a possible change in machine's operating system"
|
||||
|
||||
@@ -90,8 +90,8 @@ async def menu(
|
||||
try:
|
||||
predicates = ReactionPredicate.with_emojis(tuple(controls.keys()), message, ctx.author)
|
||||
tasks = [
|
||||
asyncio.ensure_future(ctx.bot.wait_for("reaction_add", check=predicates)),
|
||||
asyncio.ensure_future(ctx.bot.wait_for("reaction_remove", check=predicates)),
|
||||
asyncio.create_task(ctx.bot.wait_for("reaction_add", check=predicates)),
|
||||
asyncio.create_task(ctx.bot.wait_for("reaction_remove", check=predicates)),
|
||||
]
|
||||
done, pending = await asyncio.wait(
|
||||
tasks, timeout=timeout, return_when=asyncio.FIRST_COMPLETED
|
||||
|
||||
Reference in New Issue
Block a user