from irc_api import api from irc_api.api import auto_help from random import randint, choice @api.every(30, desc="Fait apparaître un canard de manière aléatoire") def pop_duck(bot): if randint(1, 10) == 1: ducks = ("Coin coin ! 🦆", "Couac ! 🦆") bot.nb_ducks += 1 bot.send("#glados", choice(ducks)) if randint(1, 10) == 1 and bot.nb_ducks > 1: bot.send("#glados", "Le canard est parti…") bot.nb_ducks -= 1 @api.channel("#glados") @api.command("pan", desc="Tirer sur un canard") def fire(bot, msg): if bot.nb_ducks > 0: bot.nb_ducks -= 1 bot.send("#glados", "Touché !") else: bot.send("#glados", "Euh va check ta vue stp…")