put MegaHAL module load in __init__, which is now being implemented here

obviously, we need to call Module.__init__ as well, and as a nice
side effect, doing all of this lets us not need to do the on_connect
nonsense, which was the wrong thing to do anyway
This commit is contained in:
Brian S. Stephan 2010-10-09 19:36:00 -05:00
parent 52b740a52c
commit 05f1ce325a

View File

@ -27,22 +27,13 @@ from Module import Module
class MegaHAL(Module): class MegaHAL(Module):
"""Have an annoying, dumb, and hilarious chatterbot on IRC.""" """Have an annoying, dumb, and hilarious chatterbot on IRC."""
def register_handlers(self, server): def __init__(self, config, server, modlist):
server.add_global_handler('welcome', self.on_connect)
server.add_global_handler('pubmsg', self.on_pubmsg)
server.add_global_handler('privmsg', self.on_privmsg)
def unregister_handlers(self):
self.server.remove_global_handler('welcome', self.on_connect)
self.server.remove_global_handler('pubmsg', self.on_pubmsg)
self.server.remove_global_handler('privmsg', self.on_privmsg)
def on_connect(self, connection, event):
""" """
Upon connecting, open the MegaHAL brain and get ready for doing actual stuff. Upon creation, open the MegaHAL brain and get ready for doing actual stuff.
""" """
self.megahal = megahal.MegaHAL() self.megahal = megahal.MegaHAL()
Module.__init__(self, config, server, modlist)
def reload(self, connection, event, nick, userhost, replypath, what, admin_unlocked): def reload(self, connection, event, nick, userhost, replypath, what, admin_unlocked):
"""Broken. Don't do anything.""" """Broken. Don't do anything."""