fix: added a loop to wait for youtube_download to finish before proceeding
This commit is contained in:
parent
fb6a12311b
commit
5a1c65a764
1 changed files with 2 additions and 0 deletions
|
@ -89,6 +89,8 @@ class MusicDownloader(commands.Cog):
|
||||||
message = await msg("YouTube Downloader started!")
|
message = await msg("YouTube Downloader started!")
|
||||||
filename = youtube_download(self, url, data_path, message)
|
filename = youtube_download(self, url, data_path, message)
|
||||||
full_filename = os.path.join(data_path, filename)
|
full_filename = os.path.join(data_path, filename)
|
||||||
|
while not os.path.isfile(full_filename):
|
||||||
|
await asyncio.sleep(1)
|
||||||
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:
|
||||||
await ctx.send(content="YouTube Downloader completed!\nDownloaded file:", file=discord.File(file, {filename}))
|
await ctx.send(content="YouTube Downloader completed!\nDownloaded file:", file=discord.File(file, {filename}))
|
||||||
|
|
Loading…
Reference in a new issue