3
0
mirror of https://github.com/jlu5/PyLink.git synced 2024-12-24 11:42:51 +01:00

Make world.plugins a dict instead of a list

This commit is contained in:
James Lu 2015-09-27 10:27:32 -07:00
parent a37d4b6f3c
commit a903f97507
2 changed files with 2 additions and 3 deletions

3
pylink
View File

@ -27,7 +27,6 @@ if __name__ == '__main__':
# Import plugins first globally, because they can listen for events # Import plugins first globally, because they can listen for events
# that happen before the connection phase. # that happen before the connection phase.
world.plugins.append(coreplugin)
to_load = conf.conf['plugins'] to_load = conf.conf['plugins']
plugins_folder = [os.path.join(os.getcwd(), 'plugins')] plugins_folder = [os.path.join(os.getcwd(), 'plugins')]
# Here, we override the module lookup and import the plugins # Here, we override the module lookup and import the plugins
@ -36,7 +35,7 @@ if __name__ == '__main__':
try: try:
moduleinfo = imp.find_module(plugin, plugins_folder) moduleinfo = imp.find_module(plugin, plugins_folder)
pl = imp.load_source(plugin, moduleinfo[1]) pl = imp.load_source(plugin, moduleinfo[1])
world.plugins.append(pl) world.plugins[plugin] = pl
except ImportError as e: except ImportError as e:
if str(e) == ('No module named %r' % plugin): if str(e) == ('No module named %r' % plugin):
log.error('Failed to load plugin %r: The plugin could not be found.', plugin) log.error('Failed to load plugin %r: The plugin could not be found.', plugin)

View File

@ -14,7 +14,7 @@ bot_commands = defaultdict(list)
command_hooks = defaultdict(list) command_hooks = defaultdict(list)
networkobjects = {} networkobjects = {}
schedulers = {} schedulers = {}
plugins = [] plugins = {}
whois_handlers = [] whois_handlers = []
started = threading.Event() started = threading.Event()