if auteur in self.ops:
if len(message)>1:
if message[1] in self.play_channels:
- serv.privmsg(auteur,"Je play déjà sur %s."%(message[1]))
- log(self.serveur,"priv",auteur," ".join(message)+"[failed]")
+ if len(message) > 2:
+ self.start_partie(serv, message[1], " ".join(message[2:]))
+ else:
+ serv.privmsg(auteur,"Je play déjà sur %s."%(message[1]))
+ log(self.serveur,"priv",auteur," ".join(message)+"[failed]")
else:
self.play_channels.append(message[1])
self.play_status[message[1]]=[None,None,None]
obfuskated=" ".join([lettre[0] if lettre[1] else "_" for lettre in mot])
serv.privmsg(canal,"%s : %s"%(begin,obfuskated))
- def start_partie(self, serv, canal):
- mots=[mot.strip() for mot in open(config.dico_mots).readlines()]
- defs=[defi.strip() for defi in open(config.dico_defs).readlines()]
- indice = random.randrange(0,len(mots))
- mot,definition=mots[indice],defs[indice]
+ def start_partie(self, serv, canal, mot=None):
+ if mot is None:
+ mots=[mot.strip() for mot in open(config.dico_mots).readlines()]
+ defs=[defi.strip() for defi in open(config.dico_defs).readlines()]
+ indice = random.randrange(0,len(mots))
+ mot,definition=mots[indice],defs[indice]
+ else:
+ definition = "(custom word)"
# ' et - sont considérés comme déjà devinés
mot = [(lettre,lettre in config.non_guess_chars) for lettre in list(mot)]
self.play_status[canal]=[mot,definition,{}]