randomise slap and kaamelott commandes

This commit is contained in:
Milka64 2019-11-17 20:18:46 +01:00
parent 2f5461f01f
commit d302775b13

View file

@ -159,15 +159,17 @@ def main():
@aiocron.crontab('50 9-23/1 * * *') @aiocron.crontab('50 9-23/1 * * *')
async def kron(): 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(): 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
ctx = await bot.get_context(current_chan.last_message) ctx = await bot.get_context(current_chan.last_message)
ctx.message.content = "" ctx.message.content = ""
print(ctx.message.content) print(ctx.message.content)
kaamelott = bot.get_command('kaamelott') random_cmd = bot.get_command(kron_choice)
await kaamelott.invoke(ctx) await random_cmd.invoke(ctx)
@aiocron.crontab('*/5 * * * *') @aiocron.crontab('*/5 * * * *')
async def pipelette(): async def pipelette():
@ -178,7 +180,7 @@ def main():
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(random.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')