Update Plugins to keep a reference to the Bot object instead of server_config

Plugins now use Bots instead of server_configs, this is useful for
checking the currently joined channels and perhaps using the connection
when there isn't one available in the current method.

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
This commit is contained in:
2022-05-30 17:03:28 -07:00
parent 9bed657f5f
commit 7b88d861fe
2 changed files with 16 additions and 10 deletions

View File

@@ -16,14 +16,13 @@ log = logging.getLogger(__name__)
class Bot:
def __init__(self, server_config: ServerConfig):
self.__server_config = server_config
self.__channels: Set[str] = set()
self.__quitting = asyncio.Event()
self.__plugins = [
plugin.load_plugin(server_config, config)
plugin.load_plugin(self, config)
for config in server_config.plugins
if config.get("enabled", True)
]
# TODO - this may not be needed
self.__channels: Set[str] = set()
self.__quitting = asyncio.Event()
@property
def server_config(self) -> ServerConfig: