feat(bot): add initial sync before continuous sync
Added an initial sync with a timeout of 30000ms before starting continuous synchronization to ensure the bot is ready with the latest state from the server. This change aims to prevent any missed messages that might occur during the startup phase.
This commit is contained in:
parent
a9ca33c77b
commit
7bfcda09b8
1 changed files with 1 additions and 0 deletions
1
bot.py
1
bot.py
|
@ -61,6 +61,7 @@ class RoombaBot:
|
||||||
|
|
||||||
async def start(self):
|
async def start(self):
|
||||||
"""Start the bot."""
|
"""Start the bot."""
|
||||||
|
await self.client.sync(timeout=30000)
|
||||||
self.client.add_event_callback(self.message_callback, nio.RoomMessageText)
|
self.client.add_event_callback(self.message_callback, nio.RoomMessageText)
|
||||||
await self.client.sync_forever(timeout=30000)
|
await self.client.sync_forever(timeout=30000)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue