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.loader.stop()
|
||||||
self.logger.debug("Stopping plugin loader.")
|
self.logger.debug("Stopping plugin loader.")
|
||||||
|
|
||||||
for name, connection in self.connections.iteritems():
|
for connection in self.connections:
|
||||||
self.logger.debug("({}) Closing connection.".format(name))
|
self.logger.debug("({}) Closing connection.".format(connection.name))
|
||||||
|
|
||||||
if reason:
|
if reason:
|
||||||
connection.cmd("QUIT", [reason])
|
connection.cmd("QUIT", [reason])
|
||||||
|
|
|
@ -57,6 +57,12 @@ class PluginLoader(object):
|
||||||
def load_file(self, path, loaded_all=False):
|
def load_file(self, path, loaded_all=False):
|
||||||
"""loads (or reloads) all valid plugins from a specified file"""
|
"""loads (or reloads) all valid plugins from a specified file"""
|
||||||
filename = os.path.basename(path)
|
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
|
# compile the file and eval it in a namespace
|
||||||
try:
|
try:
|
||||||
|
|
|
@ -12,14 +12,10 @@ def sieve_suite(bot, input, func, kind, args):
|
||||||
return None
|
return None
|
||||||
|
|
||||||
if kind == "command":
|
if kind == "command":
|
||||||
disabled_commands = conn.config.get('disabled_plugins', [])
|
disabled_commands = conn.config.get('disabled_commands', [])
|
||||||
if input.trigger in disabled_commands:
|
if input.trigger in disabled_commands:
|
||||||
return None
|
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__)
|
acl = conn.config.get('acls', {}).get(func.__name__)
|
||||||
if acl:
|
if acl:
|
||||||
|
|
Reference in a new issue