From 858782eec84a37e896836f9da30b8e122bc4ff6e Mon Sep 17 00:00:00 2001 From: nexy7574 Date: Fri, 31 May 2024 03:06:47 +0100 Subject: [PATCH] Hooks can't be async --- src/cogs/ytdl.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/cogs/ytdl.py b/src/cogs/ytdl.py index 1fc5144..6cf41bd 100644 --- a/src/cogs/ytdl.py +++ b/src/cogs/ytdl.py @@ -263,7 +263,7 @@ class YTDLCog(commands.Cog): last_edit = time.time() options = self.default_options.copy() - async def _download_hook(_data: dict[str, typing.Any]): + def _download_hook(_data: dict[str, typing.Any]): n = time.time() _total = _data.get("total_bytes", _data.get("total_bytes_estimate")) if _total: @@ -282,7 +282,7 @@ class YTDLCog(commands.Cog): if (n - last_edit) >= 5: embed.clear_fields() embed.add_field(name="Progress", value=line) - await ctx.edit(embed=embed) + ctx.bot.loop.create_task(ctx.edit(embed=embed)) last_edit = time.time() options["progress_hooks"] = [_download_hook]