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:
jack1142
2022-03-21 17:24:46 +01:00
committed by GitHub
parent 7a5ada2d92
commit ed4f2cf466
15 changed files with 27 additions and 37 deletions

View File

@@ -80,7 +80,7 @@ class Streams(commands.Cog):
self.yt_cid_pattern = re.compile("^UC[-_A-Za-z0-9]{21}[AQgw]$")
self._ready_event: asyncio.Event = asyncio.Event()
self._init_task: asyncio.Task = self.bot.loop.create_task(self.initialize())
self._init_task: asyncio.Task = asyncio.create_task(self.initialize())
async def red_delete_data_for_user(self, **kwargs):
""" Nothing to delete """
@@ -100,7 +100,7 @@ class Streams(commands.Cog):
await self.move_api_keys()
await self.get_twitch_bearer_token()
self.streams = await self.load_streams()
self.task = self.bot.loop.create_task(self._stream_alerts())
self.task = asyncio.create_task(self._stream_alerts())
except Exception as error:
log.exception("Failed to initialize Streams cog:", exc_info=error)