diff options
Diffstat (limited to 'clients/umbrella-bot')
| -rwxr-xr-x | clients/umbrella-bot/umbrella-bot.py | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/clients/umbrella-bot/umbrella-bot.py b/clients/umbrella-bot/umbrella-bot.py index 001b94c..fed3bdb 100755 --- a/clients/umbrella-bot/umbrella-bot.py +++ b/clients/umbrella-bot/umbrella-bot.py @@ -239,7 +239,8 @@ class AttachSession: "body": f"```\n{data.rstrip()}\n```", "format": "org.matrix.custom.html", "formatted_body": f"<pre><code>{data.rstrip()}</code></pre>", - } + }, + ignore_unverified_devices=True, ) except asyncio.CancelledError: pass @@ -458,7 +459,8 @@ async def run_bot(config: dict): # Load encryption keys if client.should_upload_keys: await client.keys_upload() - await client.keys_query() + if client.should_query_keys: + await client.keys_query() # Message callback async def on_message(room: MatrixRoom, event: RoomMessageText): @@ -488,7 +490,8 @@ async def run_bot(config: dict): "body": reply, "format": "org.matrix.custom.html", "formatted_body": reply.replace("\n", "<br>"), - } + }, + ignore_unverified_devices=True, ) client.add_event_callback(on_message, RoomMessageText) @@ -508,17 +511,21 @@ async def run_bot(config: dict): # Initial sync await client.sync(timeout=10000) - await client.keys_query() + if client.should_query_keys: + await client.keys_query() + + await client.joined_members(room_id) # Main sync loop async def sync_loop(): while not stop_event.is_set(): resp = await client.sync(timeout=30000, full_state=False) if isinstance(resp, SyncResponse): - # Upload any new keys if client.should_upload_keys: await client.keys_upload() - + if client.should_query_keys: + await client.keys_query() + sync_task = asyncio.create_task(sync_loop()) await stop_event.wait() |
