Exemplo n.º 1
0
    def __init__(self):
        """
        PluginManagerSingleton is shared across all plugins and the bot. We hack in access to the bot from the
        plugins themselves by settings self.plugin_manager.bot = self. In a plugin class, we simply retrieve
        the singleton in that class and call self.plugin_manager.bot.

        history is a list of dicts of previous lines of conversations, and timers is a dictionary by name
        of any Twisted LoopingCall's.
        """
        AnkhBotPlugin.bot = self  # Attach the bot to the plugin class so it can be used by all the plugins for reference.
        self.plugin_manager = Pluggo()
        self.plugin_manager.load_plugins("plugins",
                                         AnkhBotPlugin,
                                         ignore_subclasses=(CommandPlugin, ))
        pprint(self.plugin_manager.plugins)
        self.history = []
        self.timers = {}