PLAY Passe un channel en mode "jouer"
NOPLAY Passe un channel en mode "ne pas jouer"
QUIET Se taire sur un channel
- NOQUIET Opposé de QUIET"""
+ NOQUIET Opposé de QUIET
+ RELOAD Me fait recharger la conf"""
helpmsg_overops="""
SCORES {DEL|ADD|SUB} Tu veux un dessin ?
SAY Fais envoyer un message sur un chan ou à une personne
log(self.serveur,"priv",auteur," ".join(message)+"[failed]")
else:
notunderstood=True
+ elif cmd=="reload":
+ if auteur in self.ops:
+ self.reload(auteur)
+ log(self.serveur,"priv",auteur," ".join(message)+"[successful]")
+ else:
+ notunderstood=True
elif cmd in ["states","status"]:
if auteur in self.overops:
for k in self.play_status.keys():
else:
serv.privmsg(canal,"%s: crève !"%(auteur))
log(self.serveur,canal,auteur,message+"[failed]")
- if cmd in ["meur", "meurt","meurre","meurres"] and not canal in self.quiet_channels:
+ elif 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))
- if cmd in ["part","leave","dégage"]:
+ elif cmd == "reload":
+ if auteur in self.ops:
+ log(self.serveur, canal, auteur, message+"[successful]")
+ self.reload(canal)
+ elif cmd in ["part","leave","dégage"]:
if auteur in self.ops and (not (canal in self.stay_channels)
or auteur in self.overops):
self.quitter(canal)
serv.privmsg(canal,"%s: Non, je reste !"%(auteur))
log(self.serveur,canal,auteur,message+"[failed]")
- if cmd in ["deviens","pseudo"]:
+ elif cmd in ["deviens","pseudo"]:
if auteur in self.ops:
become=args
serv.nick(become)
log(self.serveur,canal,auteur,message+"[successful]")
- if cmd in ["coucou"] and not canal in self.quiet_channels:
+ elif cmd in ["coucou"] and not canal in self.quiet_channels:
serv.privmsg(canal,"%s: coucou"%(auteur))
- if cmd in ["ping"] and not canal in self.quiet_channels:
+ elif cmd in ["ping"] and not canal in self.quiet_channels:
serv.privmsg(canal,"%s: pong"%(auteur))
- if cmd in ["date","dates","histoire","énigme","enigme","encore"]:
+ elif cmd in ["date","dates","histoire","énigme","enigme","encore"]:
if canal in self.play_channels:
if self.play_status.get(canal,[-1])[0]==0:
try:
serv.privmsg(canal,("%s: Rappel : %s"%(auteur,self.play_status[canal][2])).encode("utf8") )
else:
serv.privmsg(canal,"%s: pas ici…"%(auteur))
- if cmd in ["score","!score"]:
+ elif cmd in ["score","!score"]:
serv.privmsg(auteur,"Votre score : %s"%(self.get_scores().get(auteur,0)) )
- if cmd in ["scores","!scores"]:
+ elif cmd in ["scores","!scores"]:
scores=self.get_scores().items()
# trie par score
scores.sort(lambda x,y:cmp(x[1],y[1]))
# trie par pseudo
scores.sort(lambda x,y:cmp(x[0].lower(),y[0].lower()))
serv.privmsg(auteur,"Scores by pseudo : "+" ; ".join(["%s %s"%(i[0],i[1]) for i in scores]))
- if cmd=="indice" and canal in self.play_channels:
+ elif cmd == "indice" and canal in self.play_channels:
self.give_indice(serv,canal,None)
- if is_tag(message) and not canal in self.quiet_channels:
+ elif is_tag(message) and not canal in self.quiet_channels:
if auteur in self.ops:
action=random.choice(config.tag_actions)
serv.action(canal,action.encode("utf8"))
def is_active(self,canal):
return time.time()-self.last_activity[canal]<config.idle_time
+ def reload(self, auteur=None):
+ reload(config)
+ if auteur in [None, "SIGHUP"]:
+ towrite = "Config reloaded" + " (SIGHUP received)"*(auteur == "SIGHUP")
+ for to in config.report_bugs_to:
+ self.serv.privmsg(to, towrite)
+ log(self.serveur, towrite)
+ else:
+ self.serv.privmsg(auteur,"Config reloaded")
+
def start_as_daemon(self, outfile):
sys.stderr = Logger(outfile)
self.start()
print "Server Unknown : %s"%(serveur)
exit(404)
historien=Historien(serveur,debug)
+ # Si on reçoit un SIGHUP, on reload la config
+ def sighup_handler(signum, frame):
+ historien.reload("SIGHUP")
+ signal.signal(signal.SIGHUP, sighup_handler)
if daemon:
child_pid = os.fork()
if child_pid == 0: