disabled_plugins now disables plugins!
This commit is contained in:
parent
436e1bddde
commit
c0991ffc05
3 changed files with 9 additions and 7 deletions
|
@ -147,8 +147,8 @@ class Bot(object):
|
|||
self.loader.stop()
|
||||
self.logger.debug("Stopping plugin loader.")
|
||||
|
||||
for name, connection in self.connections.iteritems():
|
||||
self.logger.debug("({}) Closing connection.".format(name))
|
||||
for connection in self.connections:
|
||||
self.logger.debug("({}) Closing connection.".format(connection.name))
|
||||
|
||||
if reason:
|
||||
connection.cmd("QUIT", [reason])
|
||||
|
|
|
@ -57,6 +57,12 @@ class PluginLoader(object):
|
|||
def load_file(self, path, loaded_all=False):
|
||||
"""loads (or reloads) all valid plugins from a specified file"""
|
||||
filename = os.path.basename(path)
|
||||
title = os.path.splitext(filename)[0]
|
||||
|
||||
disabled = self.bot.config.get('disabled_plugins', [])
|
||||
if title in disabled:
|
||||
self.bot.logger.info("Did not load plugins from: {} (plugin disabled)".format(filename))
|
||||
return None
|
||||
|
||||
# compile the file and eval it in a namespace
|
||||
try:
|
||||
|
|
|
@ -12,14 +12,10 @@ def sieve_suite(bot, input, func, kind, args):
|
|||
return None
|
||||
|
||||
if kind == "command":
|
||||
disabled_commands = conn.config.get('disabled_plugins', [])
|
||||
disabled_commands = conn.config.get('disabled_commands', [])
|
||||
if input.trigger in disabled_commands:
|
||||
return None
|
||||
|
||||
fn = re.match(r'^plugins.(.+).py$', func._filename)
|
||||
disabled = conn.config.get('disabled_plugins', [])
|
||||
if fn and fn.group(1).lower() in disabled:
|
||||
return None
|
||||
|
||||
acl = conn.config.get('acls', {}).get(func.__name__)
|
||||
if acl:
|
||||
|
|
Reference in a new issue