mirror of
https://github.com/maubot/maubot
synced 2025-09-02 05:40:37 +00:00
Refactor things and implement instance API
This commit is contained in:
parent
cbeff0c0cb
commit
bc87b2a02b
14 changed files with 249 additions and 100 deletions
|
@ -61,7 +61,7 @@ class PluginLoader(ABC):
|
|||
|
||||
async def stop_instances(self) -> None:
|
||||
await asyncio.gather(*[instance.stop() for instance
|
||||
in self.references if instance.running])
|
||||
in self.references if instance.started])
|
||||
|
||||
async def start_instances(self) -> None:
|
||||
await asyncio.gather(*[instance.start() for instance
|
||||
|
|
|
@ -23,6 +23,7 @@ import os
|
|||
|
||||
from ..lib.zipimport import zipimporter, ZipImportError
|
||||
from ..plugin_base import Plugin
|
||||
from ..config import Config
|
||||
from .abc import PluginLoader, PluginClass, IDConflictError
|
||||
|
||||
|
||||
|
@ -264,3 +265,9 @@ class ZippedPluginLoader(PluginLoader):
|
|||
except IDConflictError:
|
||||
cls.log.error(f"Duplicate plugin ID at {path}, trashing...")
|
||||
cls.trash(path)
|
||||
|
||||
|
||||
def init(config: Config) -> None:
|
||||
ZippedPluginLoader.trash_path = config["plugin_directories.trash"]
|
||||
ZippedPluginLoader.directories = config["plugin_directories.load"]
|
||||
ZippedPluginLoader.load_all()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue