Expose plugin metadata in standalone mode loader

This commit is contained in:
Tulir Asokan 2023-02-05 22:34:54 +02:00
parent f0e2bb3d62
commit 41cbf6d788
2 changed files with 4 additions and 3 deletions

View file

@ -115,7 +115,7 @@ else:
main_class = meta.main_class main_class = meta.main_class
bot_module = importlib.import_module(module) bot_module = importlib.import_module(module)
plugin: type[Plugin] = getattr(bot_module, main_class) 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__}") log.info(f"Initializing standalone {meta.id} v{meta.version} on maubot {__version__}")

View file

@ -18,12 +18,13 @@ from __future__ import annotations
import os import os
import os.path import os.path
from ..loader import BasePluginLoader from ..loader import BasePluginLoader, PluginMeta
class FileSystemLoader(BasePluginLoader): class FileSystemLoader(BasePluginLoader):
def __init__(self, path: str) -> None: def __init__(self, path: str, meta: PluginMeta) -> None:
self.path = path self.path = path
self.meta = meta
@property @property
def source(self) -> str: def source(self) -> str: