feat: added error handling for download command

This commit is contained in:
SeaswimmerTheFsh 2023-08-01 17:31:21 -04:00
parent 201ec72808
commit efbc07dd17
WARNING! Although there is a key with this ID in the database it does not verify this commit! This commit is SUSPICIOUS.
GPG key ID: 5019678FD9CF50D8

View file

@ -114,7 +114,11 @@ class MusicDownloader(commands.Cog):
await asyncio.sleep(0.5)
if os.path.isfile(full_filename):
with open(full_filename, 'rb') as file:
complete_message = await ctx.send(content="YouTube Downloader completed!\nDownloaded file:", file=discord.File(file, ytdlp_output[0]))
try:
complete_message = await ctx.send(content="YouTube Downloader completed!\nDownloaded file:", file=discord.File(file, ytdlp_output[0]))
except ValueError:
complete_message = await ctx.send(content="YouTube Downloader completed, but the audio file was too large to upload.")
return
file.close()
if delete is True or await self.bot.is_owner(ctx.author) is False:
if ytdlp_output[1] is False: