mirror of
https://github.com/maubot/maubot
synced 2025-08-29 19:00:39 +00:00
Implement instance view
This commit is contained in:
parent
0a406ac071
commit
b0d782906b
13 changed files with 478 additions and 99 deletions
|
@ -186,10 +186,27 @@ class PluginInstance:
|
|||
self.db_instance.primary_user = client.id
|
||||
self.client.references.remove(self)
|
||||
self.client = client
|
||||
self.client.references.add(self)
|
||||
await self.start()
|
||||
self.log.debug(f"Primary user switched to {self.client.id}")
|
||||
return True
|
||||
|
||||
async def update_type(self, type: str) -> bool:
|
||||
if not type or type == self.type:
|
||||
return True
|
||||
try:
|
||||
loader = PluginLoader.find(type)
|
||||
except KeyError:
|
||||
return False
|
||||
await self.stop()
|
||||
self.db_instance.type = loader.id
|
||||
self.loader.references.remove(self)
|
||||
self.loader = loader
|
||||
self.loader.references.add(self)
|
||||
await self.start()
|
||||
self.log.debug(f"Type switched to {self.loader.id}")
|
||||
return True
|
||||
|
||||
async def update_started(self, started: bool) -> None:
|
||||
if started is not None and started != self.started:
|
||||
await (self.start() if started else self.stop())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue