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:
2022-05-26 19:47:30 -07:00
parent f0cfe53c8e
commit 585f9e5952
2 changed files with 5 additions and 0 deletions

View File

@@ -19,6 +19,7 @@ class Bot:
self.__plugins = [
plugin.load_plugin(server_config, config)
for config in server_config.plugins
if config.get("enabled", True)
]
# TODO - this may not be needed
self.__channels: Set[str] = set()

View File

@@ -23,6 +23,10 @@ class Plugin:
else:
return self.server_config.channels
@property
def enabled(self) -> bool:
return self.plugin_config.get("enabled", True)
@property
def plugin_config(self) -> PluginConfig:
return self.__plugin_config