Add "enabled" config option
If a plugin has enabled = false, it will not load. Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
This commit is contained in:
@@ -19,6 +19,7 @@ class Bot:
|
|||||||
self.__plugins = [
|
self.__plugins = [
|
||||||
plugin.load_plugin(server_config, config)
|
plugin.load_plugin(server_config, config)
|
||||||
for config in server_config.plugins
|
for config in server_config.plugins
|
||||||
|
if config.get("enabled", True)
|
||||||
]
|
]
|
||||||
# TODO - this may not be needed
|
# TODO - this may not be needed
|
||||||
self.__channels: Set[str] = set()
|
self.__channels: Set[str] = set()
|
||||||
|
|||||||
@@ -23,6 +23,10 @@ class Plugin:
|
|||||||
else:
|
else:
|
||||||
return self.server_config.channels
|
return self.server_config.channels
|
||||||
|
|
||||||
|
@property
|
||||||
|
def enabled(self) -> bool:
|
||||||
|
return self.plugin_config.get("enabled", True)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def plugin_config(self) -> PluginConfig:
|
def plugin_config(self) -> PluginConfig:
|
||||||
return self.__plugin_config
|
return self.__plugin_config
|
||||||
|
|||||||
Reference in New Issue
Block a user