mirror of
https://github.com/maubot/maubot
synced 2025-09-02 05:40:37 +00:00
Finish plugin API and add basic login system
This commit is contained in:
parent
d7f072aeff
commit
14fd0d6ac9
16 changed files with 160 additions and 62 deletions
|
@ -59,10 +59,12 @@ class PluginLoader(ABC):
|
|||
pass
|
||||
|
||||
async def stop_instances(self) -> None:
|
||||
await asyncio.gather([instance.stop() for instance in self.references if instance.running])
|
||||
await asyncio.gather(*[instance.stop() for instance
|
||||
in self.references if instance.running])
|
||||
|
||||
async def start_instances(self) -> None:
|
||||
await asyncio.gather([instance.start() for instance in self.references if instance.enabled])
|
||||
await asyncio.gather(*[instance.start() for instance
|
||||
in self.references if instance.enabled])
|
||||
|
||||
@abstractmethod
|
||||
async def load(self) -> Type[PluginClass]:
|
||||
|
|
|
@ -207,8 +207,10 @@ class ZippedPluginLoader(PluginLoader):
|
|||
self.log.debug(f"Loaded and imported plugin {self.id} from {self.path}")
|
||||
return plugin
|
||||
|
||||
async def reload(self) -> Type[PluginClass]:
|
||||
async def reload(self, new_path: Optional[str] = None) -> Type[PluginClass]:
|
||||
await self.unload()
|
||||
if new_path is not None:
|
||||
self.path = new_path
|
||||
return await self.load(reset_cache=True)
|
||||
|
||||
async def unload(self) -> None:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue