3
0
mirror of https://github.com/jlu5/PyLink.git synced 2025-02-17 14:01:03 +01:00

commands: only allow loading plugins that aren't already loaded

This commit is contained in:
James Lu 2015-09-27 12:12:58 -07:00
parent 38a350a5f8
commit 5aeaac0394

View File

@ -216,6 +216,9 @@ def load(irc, source, args):
except IndexError: except IndexError:
irc.msg(irc.called_by, "Error: Not enough arguments. Needs 1: plugin name.") irc.msg(irc.called_by, "Error: Not enough arguments. Needs 1: plugin name.")
return return
if name in world.plugins:
irc.msg(irc.called_by, "Error: %r is already loaded." % name)
return
try: try:
world.plugins[name] = pl = __import__(name) world.plugins[name] = pl = __import__(name)
except ImportError as e: except ImportError as e: