smal: allow the bot to start without sync
This commit is contained in:
parent
7ed8e1c186
commit
ccf426e8b0
1 changed files with 5 additions and 4 deletions
|
|
@ -30,16 +30,17 @@ class SMALApp(_AsyncClient):
|
|||
def __init__(self):
|
||||
super().__init__()
|
||||
|
||||
def run(self):
|
||||
asyncio.run(self.main_loop())
|
||||
def run(self, sync=True):
|
||||
asyncio.run(self.main_loop(sync))
|
||||
|
||||
async def main_loop(self):
|
||||
async def main_loop(self, sync):
|
||||
if hasattr(self, "on_startup") and callable(self.on_startup):
|
||||
await self.on_startup()
|
||||
|
||||
if hasattr(self, "on_startup_run") and callable(self.on_startup_run):
|
||||
await asyncio.ensure_future(self.on_startup_run())
|
||||
|
||||
if sync:
|
||||
await self._sync()
|
||||
|
||||
def stop(self):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue