From 6fce9ee607291d520004a77d34c60e6ab8b13bde Mon Sep 17 00:00:00 2001 From: Astra Logical Date: Thu, 23 Jul 2026 10:53:16 -0400 Subject: [PATCH] Further data structure issues --- matrix_keycloak_bot.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/matrix_keycloak_bot.py b/matrix_keycloak_bot.py index 7a5f868..9fc81e6 100644 --- a/matrix_keycloak_bot.py +++ b/matrix_keycloak_bot.py @@ -18,6 +18,7 @@ from nio import ( KeyVerificationCancel, ToDeviceError, UnknownToDeviceEvent, + ToDeviceMessage, ) # ------------------------------------------------------------------------------ @@ -155,14 +156,19 @@ async def on_to_device(client: AsyncClient, event): "methods": ["m.sas.v1"], "transaction_id": tx_id, } - resp = await client.to_device( + + # Wrap the event type and dictionary in a ToDeviceMessage object + message = ToDeviceMessage( "m.key.verification.ready", { event.sender: { from_device: ready_content } - }, + } ) + + resp = await client.to_device(message) + if isinstance(resp, ToDeviceError): print(f"Failed to send verification ready: {resp}") else: