From 903f399fa7c2a4352e73277a84cc935201eab092 Mon Sep 17 00:00:00 2001 From: Vincent Le Gallic Date: Fri, 18 May 2012 00:10:42 +0200 Subject: [PATCH] =?utf8?q?self.nick=20est=20une=20property=20qui=20r=C3=A9?= =?utf8?q?cup=C3=A8re=20le=20pseudo=20courant=20sur=20le=20serveur?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- basile.py | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/basile.py b/basile.py index 10433cc..88afebc 100755 --- a/basile.py +++ b/basile.py @@ -383,8 +383,7 @@ class Basile(ircbot.SingleServerIRCBot): (auteur,fille,verbe)).encode("utf8")) def pourmoi(self, serv, message): """renvoie (False,lemessage) ou (True, le message amputé de "pseudo: ")""" - pseudo=serv.get_nickname() - size=len(pseudo) + size=len(self.nick) if message[:size]==pseudo and len(message)>size and message[size]==":": return (True,message[size+1:].lstrip(" ")) else: @@ -826,7 +825,7 @@ class Basile(ircbot.SingleServerIRCBot): serv.privmsg(canal,"%s: %s"%(auteur,answer)) if not canal in self.quiet_channels: self.try_tamere(serv,canal,auteur,message) - mypseudo=serv.get_nickname() + mypseudo=self.nick if re.match((u"^("+u"|".join(config_bonjour) +u")( {}| all| tout le monde|(|à) tous)(\.|( |)!|)$" ).format(mypseudo).lower(), message.strip().lower()): @@ -852,7 +851,7 @@ class Basile(ircbot.SingleServerIRCBot): serv.privmsg(channel, "%s : Euh, tu fais de la merde avec ton encodage là, j'ai failli crasher…"%(auteur)) return - mypseudo=serv.get_nickname() + mypseudo=self.nick if is_action_trigger(action,mypseudo) and not channel in self.quiet_channels: l1,l2=config_action_answers,config_action_actions @@ -863,6 +862,20 @@ class Basile(ircbot.SingleServerIRCBot): else: serv.privmsg(channel,"%s: %s"%(auteur,l1[i].encode("utf8"))) + def on_kick(self,serv,ev): + auteur = irclib.nm_to_n(ev.source()) + canal = ev.target() + victime = ev.arguments()[0] + raison = ev.arguments()[1] + if victime==self.nick: + time.sleep(1) + serv.join(canal) + print("%s kické par %s pour %s" %(victime,auteur,raison)) + def _getnick(self): + return serv.get_nickname() + nick=property(_getnick) + + if __name__=="__main__": import sys if len(sys.argv)==1: -- 2.39.2