From 477e765316d2b1ac1d2b49a7225d44d526f84db0 Mon Sep 17 00:00:00 2001 From: Milka64 Date: Tue, 5 May 2020 21:16:42 +0200 Subject: [PATCH] fix os.path error --- kabot/kabot/kabot.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/kabot/kabot/kabot.py b/kabot/kabot/kabot.py index 0d6b833..496dfda 100644 --- a/kabot/kabot/kabot.py +++ b/kabot/kabot/kabot.py @@ -199,10 +199,10 @@ class Mybot(commands.Cog): async def joke(self, ctx, folder=None): user = ctx.message.author.name if not folder or not ctx.message.content: - audio_file = random.choice([f for f in Path(here + '/Audio/').glob('**/*.mp3')]) + audio_file = random.choice([f"{f}" for f in Path(here + '/Audio/').glob('**/*.mp3')]) else: folder = folder.lower() - audio_file = random.choice([f for f in Path(here + '/Audio/').glob('**/*.mp3') if folder in str(f).lower()]) + audio_file = random.choice([f"{f}" for f in Path(here + '/Audio/').glob('**/*.mp3') if folder in str(f).lower()]) self.sounds.append((audio_file, ctx)) @commands.command(help="optionnal args : [livre] [character]") @@ -386,7 +386,7 @@ class Mybot(commands.Cog): audio_file = random.choice([f for f in os.listdir(here + '/Audio/%s/' % user) if f.endswith('.mp3')]) audio_file = here + '/Audio/%s/' % user + audio_file except: - audio_file = random.choice([f for f in Path(here + '/Audio/').glob('**/*.mp3')]) + audio_file = random.choice([f"{f}" for f in Path(here + '/Audio/').glob('**/*.mp3')]) self.sounds.append((audio_file, ctx)) #Fin des commandes pour faire mumuse avec Kabot.