feat: added error handling for download command
This commit is contained in:
parent
201ec72808
commit
efbc07dd17
1 changed files with 5 additions and 1 deletions
|
@ -114,7 +114,11 @@ class MusicDownloader(commands.Cog):
|
||||||
await asyncio.sleep(0.5)
|
await asyncio.sleep(0.5)
|
||||||
if os.path.isfile(full_filename):
|
if os.path.isfile(full_filename):
|
||||||
with open(full_filename, 'rb') as file:
|
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()
|
file.close()
|
||||||
if delete is True or await self.bot.is_owner(ctx.author) is False:
|
if delete is True or await self.bot.is_owner(ctx.author) is False:
|
||||||
if ytdlp_output[1] is False:
|
if ytdlp_output[1] is False:
|
||||||
|
|
Loading…
Reference in a new issue