Further data structure issues
This commit is contained in:
parent
4326dac96c
commit
6fce9ee607
1 changed files with 8 additions and 2 deletions
|
|
@ -18,6 +18,7 @@ from nio import (
|
||||||
KeyVerificationCancel,
|
KeyVerificationCancel,
|
||||||
ToDeviceError,
|
ToDeviceError,
|
||||||
UnknownToDeviceEvent,
|
UnknownToDeviceEvent,
|
||||||
|
ToDeviceMessage,
|
||||||
)
|
)
|
||||||
|
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
|
|
@ -155,14 +156,19 @@ async def on_to_device(client: AsyncClient, event):
|
||||||
"methods": ["m.sas.v1"],
|
"methods": ["m.sas.v1"],
|
||||||
"transaction_id": tx_id,
|
"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",
|
"m.key.verification.ready",
|
||||||
{
|
{
|
||||||
event.sender: {
|
event.sender: {
|
||||||
from_device: ready_content
|
from_device: ready_content
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
resp = await client.to_device(message)
|
||||||
|
|
||||||
if isinstance(resp, ToDeviceError):
|
if isinstance(resp, ToDeviceError):
|
||||||
print(f"Failed to send verification ready: {resp}")
|
print(f"Failed to send verification ready: {resp}")
|
||||||
else:
|
else:
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue