WIP on #11
This commit is contained in:
parent
7031a76b06
commit
abb7f34d9f
1 changed files with 22 additions and 16 deletions
|
@ -238,17 +238,23 @@ class Mybot(commands.Cog):
|
||||||
else:
|
else:
|
||||||
await ctx.channel.send("Exception : No api key found")
|
await ctx.channel.send("Exception : No api key found")
|
||||||
|
|
||||||
|
|
||||||
@commands.guild_only()
|
@commands.guild_only()
|
||||||
@commands.command()
|
@commands.command()
|
||||||
async def joke(self, ctx, folder=None):
|
async def joke(self, ctx, folder=None):
|
||||||
user = ctx.message.author.name
|
try:
|
||||||
if not folder or not ctx.message.content:
|
user = ctx.message.author.name
|
||||||
audio_file = random.choice([f"{f}" for f in Path(self.audio_path + '/').glob('**/*.mp3')])
|
if not folder or not ctx.message.content:
|
||||||
else:
|
audio_file = random.choice([f"{f}" for f in Path(self.audio_path + '/').glob('**/*.mp3')])
|
||||||
folder = folder.lower()
|
else:
|
||||||
audio_file = random.choice([f"{f}" for f in Path(self.audio_path + '/').glob('**/*.mp3') if folder in str(f).lower()])
|
folder = folder.lower()
|
||||||
self.sounds.append((audio_file, ctx))
|
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]")
|
@commands.command(help="optionnal args : [livre] [character]")
|
||||||
async def kaamelott(self, ctx, *args):
|
async def kaamelott(self, ctx, *args):
|
||||||
|
|
Loading…
Reference in a new issue