fix guild_only && add jean-michel sound

This commit is contained in:
Milka64 2019-11-06 22:01:06 +01:00
parent 3c64624d0d
commit 87f1f7af00
2 changed files with 4 additions and 5 deletions

View file

@ -31,12 +31,11 @@ class Mybot(commands.Cog):
async def disconnect(self, ctx): async def disconnect(self, ctx):
await ctx.guild.voice_client.disconnect() await ctx.guild.voice_client.disconnect()
@commands.guild_only()
@commands.command() @commands.command()
async def joke(self, ctx, folder=None): async def joke(self, ctx, folder=None):
if ctx.message.author.name == self.bot.user.name:
return
user = ctx.message.author.name user = ctx.message.author.name
if not folder: if not folder or not ctx.message.content:
audio_file = random.choice([f for f in Path('/home/mika/kabot/kabot/kabot/Audio/').glob('**/*.mp3')]) audio_file = random.choice([f for f in Path('/home/mika/kabot/kabot/kabot/Audio/').glob('**/*.mp3')])
else: else:
folder = folder.lower() folder = folder.lower()
@ -152,11 +151,11 @@ def main():
for channel in bot.get_all_channels(): for channel in bot.get_all_channels():
if channel.name == "Général" and\ if channel.name == "Général" and\
len(channel.members) > 1 and\ len(channel.members) > 1 and\
random.choice([True,False,False]): random.choice([True,True,True]):
for channel in bot.get_all_channels(): for channel in bot.get_all_channels():
if channel.name == "général": if channel.name == "général":
current_chan = channel current_chan = channel
sleep(choice(range(350))) #sleep(random.choice(range(350)))
ctx = await bot.get_context(current_chan.last_message) ctx = await bot.get_context(current_chan.last_message)
ctx.message.content = "" ctx.message.content = ""
joke = bot.get_command('joke') joke = bot.get_command('joke')