MegaHAL: do add_global_handler in the right place, actually do remove_global_handler

This commit is contained in:
Brian S. Stephan 2011-01-08 00:31:19 -06:00
parent 36fcbde267
commit 07be2f3a85
1 changed files with 8 additions and 1 deletions

View File

@ -37,10 +37,17 @@ class MegaHAL(Module):
Module.__init__(self, irc, config, server)
mh_python.initbrain()
def register_handlers(self, server):
"""Handle pubmsg/privmsg, so we can learn only from IRC events."""
self.server.add_global_handler('pubmsg', self.learn_from_irc_event)
self.server.add_global_handler('privmsg', self.learn_from_irc_event)
mh_python.initbrain()
def unregister_handlers(self):
self.server.remove_global_handler('pubmsg', self.learn_from_irc_event)
self.server.remove_global_handler('privmsg', self.learn_from_irc_event)
def save(self):
"""Sync the megahal brain."""