From 1dcdbe3cf03ff16b3ff2e2e6d572e0b3c72c18c0 Mon Sep 17 00:00:00 2001 From: salmonik Date: Sun, 19 Apr 2026 15:43:32 +0200 Subject: refactor: simplify cogs, reduce complexity - Remove unused imports and dead code - Cleaner error handling - Reduce cognitive complexity --- cogs/music/play_commands.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'cogs/music/play_commands.py') diff --git a/cogs/music/play_commands.py b/cogs/music/play_commands.py index fd5113a..a82fa9d 100644 --- a/cogs/music/play_commands.py +++ b/cogs/music/play_commands.py @@ -6,6 +6,7 @@ import logging import os import urllib.parse +import asyncio from os import PathLike from typing import Awaitable, Callable, List, Tuple @@ -139,9 +140,10 @@ class PlayCommands(commands.Cog): local_path = os.path.join(self.temp_dir, filename) os.makedirs(self.temp_dir, exist_ok=True) + loop = asyncio.get_event_loop() with open(local_path, "wb") as f: async for chunk in response.content.iter_chunked(8192): - f.write(chunk) + await loop.run_in_executor(None, f.write, chunk) compressed_path = await media_processing.AudioCompressor.compress( ctx, local_path -- cgit v1.2.3