From d302775b13afe885cc58a96ddcb20c93ddc4a223 Mon Sep 17 00:00:00 2001 From: Milka64 Date: Sun, 17 Nov 2019 20:18:46 +0100 Subject: [PATCH] randomise slap and kaamelott commandes --- kabot/kabot/kabot.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/kabot/kabot/kabot.py b/kabot/kabot/kabot.py index c200297..df2863b 100644 --- a/kabot/kabot/kabot.py +++ b/kabot/kabot/kabot.py @@ -159,15 +159,17 @@ def main(): @aiocron.crontab('50 9-23/1 * * *') async def kron(): - if random.choice([True,True,True]): + kron_choice = random.choice(["kaamelott","slap","kaamelott",False]) + if kron_choice: + sleep(random.choice(range(3550))) for channel in bot.get_all_channels(): if channel.name == "général": current_chan = channel ctx = await bot.get_context(current_chan.last_message) ctx.message.content = "" print(ctx.message.content) - kaamelott = bot.get_command('kaamelott') - await kaamelott.invoke(ctx) + random_cmd = bot.get_command(kron_choice) + await random_cmd.invoke(ctx) @aiocron.crontab('*/5 * * * *') async def pipelette(): @@ -178,7 +180,7 @@ def main(): for channel in bot.get_all_channels(): if channel.name == "général": current_chan = channel - #sleep(random.choice(range(350))) + sleep(random.choice(range(350))) ctx = await bot.get_context(current_chan.last_message) ctx.message.content = "" joke = bot.get_command('joke')