def load(self, name, *plugins): '''Loads the specified plugin. Example: !load dice''' try: Plugin.load(name, *plugins) except ImportError: return 'Could not load {0}'.format(name) return '{0} was successfully loaded'.format(name)
def unload(self, name, *plugins): '''Unloads the specified plugin. Example: !unload dice''' try: Plugin.unload(name, *plugins) return '{0} was successfully unloaded'.format(name) except KeyError: return 'No such plugin is currently loaded. Try !load {0}'.format(name)
def reload(self, name='all'): '''Reloads the specified plugin. Example: !reload dice''' try: if name == 'all': keys = [x for x in Plugin.library.iterkeys()] for module in keys: Plugin.reload(module) return 'All plugins were successfully reloaded.' else: Plugin.reload(name) return '{0} were successfully reloaded.'.format(name) except KeyError: return 'No such plugin is currently loaded. Try !load {0}'.format(name)
def startFactory(self): for plugin in settings.PLUGINS: Plugin.load(plugin) protocol.ClientFactory.startFactory(self)