From: Vincent Le Gallic Date: Mon, 14 May 2012 12:07:15 +0000 (+0200) Subject: Réponse à la donnée de lettres, le bot est fonctionnel X-Git-Url: http://gitweb.pimeys.fr/?p=bots%2Fhung.git;a=commitdiff_plain;h=489fe8b655472c42154b7bef9b7b26c11043c529 Réponse à la donnée de lettres, le bot est fonctionnel --- 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: