fix(youtubedownloader): fixed videos being uploaded with the wrong filename
Some checks failed
Pylint / Pylint (3.10) (push) Failing after 53s

This commit is contained in:
Seaswimmer 2023-10-24 00:22:33 -04:00
parent 549b626dda
commit c83e1bddb5
No known key found for this signature in database
GPG key ID: 5019678FD9CF50D8

View file

@ -78,7 +78,7 @@ class YouTubeDownloader(commands.Cog):
previously_existed = True previously_existed = True
else: else:
previously_existed = False previously_existed = False
return yt.streams.first().download(filename=filename, output_path=path), previously_existed return yt.streams.first().download(filename=filename, output_path=path), previously_existed, filename_format
data_path = await self.config.save_directory() data_path = await self.config.save_directory()
if subfolder and await self.bot.is_owner(ctx.author): if subfolder and await self.bot.is_owner(ctx.author):
data_path = os.path.join(data_path, subfolder) data_path = os.path.join(data_path, subfolder)
@ -117,7 +117,7 @@ class YouTubeDownloader(commands.Cog):
if os.path.isfile(output[0]): if os.path.isfile(output[0]):
with open(output[0], 'rb') as file: with open(output[0], 'rb') as file:
try: try:
complete_message = await ctx.send(content="YouTube Downloader completed!\nDownloaded file:", file=discord.File(file, output[0])) complete_message = await ctx.send(content="YouTube Downloader completed!\nDownloaded file:", file=discord.File(file, output[3]))
except ValueError: except ValueError:
complete_message = await ctx.send(content="YouTube Downloader completed, but the file was too large to upload.") complete_message = await ctx.send(content="YouTube Downloader completed, but the file was too large to upload.")
file.close() file.close()