From 41cbf6d7886f91cacfc9424109bdf39899d5ffc1 Mon Sep 17 00:00:00 2001 From: Tulir Asokan Date: Sun, 5 Feb 2023 22:34:54 +0200 Subject: [PATCH] Expose plugin metadata in standalone mode loader --- maubot/standalone/__main__.py | 2 +- maubot/standalone/loader.py | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/maubot/standalone/__main__.py b/maubot/standalone/__main__.py index 40a218d..87adc35 100644 --- a/maubot/standalone/__main__.py +++ b/maubot/standalone/__main__.py @@ -115,7 +115,7 @@ else: main_class = meta.main_class bot_module = importlib.import_module(module) plugin: type[Plugin] = getattr(bot_module, main_class) -loader = FileSystemLoader(os.path.dirname(args.meta)) +loader = FileSystemLoader(os.path.dirname(args.meta), meta) log.info(f"Initializing standalone {meta.id} v{meta.version} on maubot {__version__}") diff --git a/maubot/standalone/loader.py b/maubot/standalone/loader.py index 8c75c05..3d5a907 100644 --- a/maubot/standalone/loader.py +++ b/maubot/standalone/loader.py @@ -18,12 +18,13 @@ from __future__ import annotations import os import os.path -from ..loader import BasePluginLoader +from ..loader import BasePluginLoader, PluginMeta class FileSystemLoader(BasePluginLoader): - def __init__(self, path: str) -> None: + def __init__(self, path: str, meta: PluginMeta) -> None: self.path = path + self.meta = meta @property def source(self) -> str: