From 33be6d59f45dfefee35a808188ff5f313e8d2394 Mon Sep 17 00:00:00 2001 From: Milka64 Date: Tue, 8 Sep 2020 11:02:42 +0200 Subject: [PATCH] fix youtube error in play cmd --- kabot/kabot/kabot.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/kabot/kabot/kabot.py b/kabot/kabot/kabot.py index 0e28ef0..c87ef0a 100644 --- a/kabot/kabot/kabot.py +++ b/kabot/kabot/kabot.py @@ -318,7 +318,9 @@ class Mybot(commands.Cog): with youtube_dl.YoutubeDL(ydl_opts) as ydl: ydl.download([url]) info_dict = ydl.extract_info(url, download=False) - out_file = ydl.prepare_filename(info_dict).replace(".webm", ".mp3") + out_file = ydl.prepare_filename(info_dict) + extension = out_file.split('.')[-1] + out_file = out_file.replace(extension, 'mp3') self.sounds.append((out_file, ctx)) @commands.command()