From 489fe8b655472c42154b7bef9b7b26c11043c529 Mon Sep 17 00:00:00 2001 From: Vincent Le Gallic Date: Mon, 14 May 2012 14:07:15 +0200 Subject: [PATCH] =?utf8?q?R=C3=A9ponse=20=C3=A0=20la=20donn=C3=A9e=20de=20?= =?utf8?q?lettres,=20le=20bot=20est=20fonctionnel?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- hung.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/hung.py b/hung.py index 7f25389..e4c4615 100755 --- a/hung.py +++ b/hung.py @@ -312,6 +312,19 @@ class Hung(ircbot.SingleServerIRCBot): self.start_partie(serv, canal) elif not canal in self.play_channels: serv.privmsg(canal,"%s: pas ici…"%(auteur)) + elif (cmd in list("azertyuiopqsdfghjklmwxcvbn") and canal in self.play_channels + and self.play_status.has_key(canal) and self.play_status[canal]!=[None]): + giv_let=cmd.upper() + liste=self.play_status[canal] + listeapres=[(lettre[0],lettre[1] or lettre[0]==giv_let) for lettre in liste] + if liste!=listeapres: + self.play_status[canal]=listeapres + self.affiche_mot(serv, canal, begin="%s trouvé"%(giv_let)) + if all([lettre[1] for lettre in listeapres]): + serv.privmsg(canal,"Bravo ! C'était %s"%("".join([lettre[0] for lettre in listeapres]))) + self.play_status[canal]=[None] + + if cmd in ["meur", "meurt","meurre","meurres"] and not canal in self.quiet_channels: serv.privmsg(canal,'%s: Mourir, impératif, 2ème personne du singulier : "meurs" (de rien)'%(auteur)) else: -- 2.39.2