mirror of
https://github.com/maubot/maubot
synced 2025-08-30 22:30:38 +00:00
Add configuration for plugins
This commit is contained in:
parent
ac5f059ef4
commit
b29a7d186e
7 changed files with 57 additions and 9 deletions
|
@ -41,6 +41,7 @@ class ZippedPluginLoader(PluginLoader):
|
|||
main_module: str
|
||||
_loaded: Type[PluginClass]
|
||||
_importer: zipimporter
|
||||
_file: ZipFile
|
||||
|
||||
def __init__(self, path: str) -> None:
|
||||
super().__init__()
|
||||
|
@ -76,10 +77,13 @@ class ZippedPluginLoader(PluginLoader):
|
|||
f"id='{self.id}' "
|
||||
f"loaded={self._loaded is not None}>")
|
||||
|
||||
def read_file(self, path: str) -> bytes:
|
||||
return self._file.read(path)
|
||||
|
||||
def _load_meta(self) -> None:
|
||||
try:
|
||||
file = ZipFile(self.path)
|
||||
data = file.read("maubot.ini")
|
||||
self._file = ZipFile(self.path)
|
||||
data = self._file.read("maubot.ini")
|
||||
except FileNotFoundError as e:
|
||||
raise MaubotZipImportError("Maubot plugin not found") from e
|
||||
except BadZipFile as e:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue