log(self.serveur, place, auteur, something + "%r" % params + ("[successful]" if success else "[failed]"))
+ def acknowledge(self, asked_by, asked_where, message):
+ """Répond quelque chose au demandeur d'une action.
+ ``asked_where=None`` signifie en privé."""
+ if asked_where is None:
+ self.serv.privmsg(asked_by, message)
+ else:
+ self.serv.privmsg(asked_where, "%s: %s" % (asked_by, message))
+
+ def dump(self, asked_by, asked_where=None):
+ """Dumpe les quotes. ``asked_where=None`` signifie en privé."""
+ quotes.dump(self.quotedb)
+ self.acknowledge(asked_by, asked_where, "Quotes dumpées")
+
+ def restore(self, asked_by, asked_where=None):
+ """Restaure les quotes à partir du dump. ``asked_where=None`` signifie en privé."""
+ self.quotedb = quotes.restore()
+ self.acknowledge(asked_by, asked_where, "Quotes restaurées à partir du dump (pas de backup effectué).")
### Surcharge des events du Bot
def on_welcome(self, serv, ev):
serv.privmsg(auteur, " ".join(self.overops))
else:
notunderstood = True
+ elif cmd == u"dump" and auteur in self.ops:
+ self.dump(asked_by=auteur)
+ elif cmd == u"restore" and auteur in self.overops:
+ self.restore(asked_by=auteur)
else:
notunderstood = True
if notunderstood:
elif cmd in [u"ping"] and not canal in self.quiet_channels:
serv.privmsg(canal, "%s: pong" % (auteur))
+ elif cmd in [u"dump"]:
+ self.dump(asked_by=auteur, asked_where=canal)
+ elif cmd in [u"restore"] and auteur in self.overops:
+ self.restore(asked_by=auteur, asked_where=canal)
else:
# Vu que ce bot est prévu pour parser des quotes il va falloir bosser ici
match = quote_pattern.match(message)