This commit is contained in:
Milka64 2021-02-18 22:08:17 +01:00
parent b719019dbd
commit 5207baf83f

View file

@ -247,10 +247,12 @@ class Mybot(commands.Cog):
audio_file = random.choice([f"{f}" for f in Path(self.audio_path + '/').glob('**/*.mp3')]) audio_file = random.choice([f"{f}" for f in Path(self.audio_path + '/').glob('**/*.mp3')])
else: else:
folder = folder.lower() folder = folder.lower()
audio_file = random.choice([f"{f}" for f in Path(self.audio_path + '/').glob('**/*.mp3') if folder in str(f).lower()]) audio_file = [f"{f}" for f in Path(self.audio_path + '/').glob('**/*.mp3') if folder in str(f).lower()]
if not audio_file: if not audio_file:
ctx.channel.send("%s not found" % folder) ctx.channel.send("%s not found" % folder)
self.sounds.append((audio_file, ctx)) else:
audio_file = random.choice(audio_file)
self.sounds.append((audio_file, ctx))
except: except:
e = exc_info()[0] e = exc_info()[0]
await ctx.channel.send("Exception when calling joke: %s\n" % e) await ctx.channel.send("Exception when calling joke: %s\n" % e)