]> gitweb.pimeys.fr Git - bots/basile.git/blobdiff - basile.py
Commande DO pour faire faire des actions
[bots/basile.git] / basile.py
index fdefe8dda02bef8c8b7d8405e0ce034fb6345ee4..a98396461e38c5cb422d4fb04de17e90725204bd 100755 (executable)
--- a/basile.py
+++ b/basile.py
@@ -231,7 +231,7 @@ def is_tamere(chain):
     return is_something(chain,config_tamere)
 def is_action_trigger(chain,pseudo):
     return is_something(chain,config_action_trigger,avant=u"^",
     return is_something(chain,config_tamere)
 def is_action_trigger(chain,pseudo):
     return is_something(chain,config_action_trigger,avant=u"^",
-                            apres="([a-z]*ment)? %s($|\.| |,|;).*"%(pseudo))
+                            apres="( [a-z]*ment)? %s($|\.| |,|;).*"%(pseudo))
 def is_pan(chain):
     return re.match(u"^(pan|bim|bang)$",unicode(chain,"utf8").lower().strip())
 
 def is_pan(chain):
     return re.match(u"^(pan|bim|bang)$",unicode(chain,"utf8").lower().strip())
 
@@ -445,6 +445,7 @@ class Basile(ircbot.SingleServerIRCBot):
  SOLDE <pseudo>  Donner le solde de quelqu'un"""
             helpmsg_overops="""
  SAY        Fait envoyer un message sur un chan ou à une personne
  SOLDE <pseudo>  Donner le solde de quelqu'un"""
             helpmsg_overops="""
  SAY        Fait envoyer un message sur un chan ou à une personne
+ DO         Fait faire une action sur un chan
  STAY       Ignorera les prochains LEAVE pour un chan
  NOSTAY     Opposé de STAY
  DIE        Mourir"""
  STAY       Ignorera les prochains LEAVE pour un chan
  NOSTAY     Opposé de STAY
  DIE        Mourir"""
@@ -590,6 +591,14 @@ class Basile(ircbot.SingleServerIRCBot):
                 serv.privmsg(auteur,"Syntaxe : SAY <channel> <message>")
             else:
                 notunderstood=True
                 serv.privmsg(auteur,"Syntaxe : SAY <channel> <message>")
             else:
                 notunderstood=True
+        elif cmd=="do":
+            if auteur in self.overops and len(message)>2:
+                serv.action(message[1]," ".join(message[2:]))
+                log(self.serveur,"priv",auteur," ".join(message))
+            elif len(message)<=2:
+                serv.privmsg(auteur,"Syntaxe : DO <channel> <action>")
+            else:
+                notunderstood=True
         elif cmd=="lost":
             if auteur in self.ops and len(message)>1:
                 serv.privmsg(message[1],"J'ai perdu !")
         elif cmd=="lost":
             if auteur in self.ops and len(message)>1:
                 serv.privmsg(message[1],"J'ai perdu !")