This commit is contained in:
Milka64 2021-02-18 21:54:01 +01:00
parent 7031a76b06
commit abb7f34d9f

View file

@ -238,17 +238,23 @@ class Mybot(commands.Cog):
else:
await ctx.channel.send("Exception : No api key found")
@commands.guild_only()
@commands.command()
async def joke(self, ctx, folder=None):
try:
user = ctx.message.author.name
if not folder or not ctx.message.content:
audio_file = random.choice([f"{f}" for f in Path(self.audio_path + '/').glob('**/*.mp3')])
else:
folder = folder.lower()
audio_file = random.choice([f"{f}" for f in Path(self.audio_path + '/').glob('**/*.mp3') if folder in str(f).lower()])
if not audio_file:
ctx.channel.send("%s not found" % folder)
self.sounds.append((audio_file, ctx))
except:
e = sys.exc_info()[0]
await ctx.channel.send("Exception when calling joke: %s\n" % e)
@commands.command(help="optionnal args : [livre] [character]")
async def kaamelott(self, ctx, *args):