From c4b490920fc824a501254c1eaf268a581db4fce1 Mon Sep 17 00:00:00 2001 From: Kaya <95276965+kytpbs@users.noreply.github.com> Date: Tue, 6 Aug 2024 03:42:00 +0300 Subject: [PATCH] move converting to discord files into try-catch this should result in less errors causing a infinite load error --- src/download_commands.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/download_commands.py b/src/download_commands.py index 16a0603..5ba5f8b 100644 --- a/src/download_commands.py +++ b/src/download_commands.py @@ -17,12 +17,13 @@ async def download_video_command(interaction: discord.Interaction, url: str, is_ try: attachments = downloader.download_video_from_link(url) + file_paths = [attachment.path for attachment in attachments] + discord_files = convert_paths_to_discord_files(file_paths) except Exception as e: await interaction.followup.send("Bir şey ters gitti... lütfen tekrar deneyin", ephemeral=True) raise e # re-raise the exception so we can see what went wrong - file_paths = [attachment.path for attachment in attachments] if len(attachments) == 0: await interaction.followup.send("Bir şeyler ters gitti, lütfen tekrar deneyin", ephemeral=True) return content = " + ".join(filter(None, [attachment.caption for attachment in attachments])) or "Video Downloaded" - await interaction.followup.send(content, files=convert_paths_to_discord_files(file_paths)) + await interaction.followup.send(content, files=discord_files, ephemeral=is_ephemeral)