feat: support shared-workspace file flow for matrix
This commit is contained in:
parent
323a6d3144
commit
6422c7db58
18 changed files with 871 additions and 80 deletions
|
|
@ -75,6 +75,27 @@ async def test_dispatch_routes_audio_before_catchall(dispatcher):
|
|||
assert (await dispatcher.dispatch(text_msg))[0].text == "text"
|
||||
|
||||
|
||||
async def test_dispatch_routes_document_before_catchall(dispatcher):
|
||||
async def document_handler(event, **kwargs):
|
||||
return [OutgoingMessage(chat_id=event.chat_id, text="document")]
|
||||
|
||||
async def catch_all(event, **kwargs):
|
||||
return [OutgoingMessage(chat_id=event.chat_id, text="text")]
|
||||
|
||||
dispatcher.register(IncomingMessage, "document", document_handler)
|
||||
dispatcher.register(IncomingMessage, "*", catch_all)
|
||||
|
||||
document_msg = IncomingMessage(
|
||||
user_id="u1",
|
||||
platform="matrix",
|
||||
chat_id="C1",
|
||||
text="",
|
||||
attachments=[Attachment(type="document", workspace_path="surfaces/matrix/u1/file.pdf")],
|
||||
)
|
||||
|
||||
assert (await dispatcher.dispatch(document_msg))[0].text == "document"
|
||||
|
||||
|
||||
async def test_dispatch_callback_by_action(dispatcher):
|
||||
async def confirm_handler(event, **kwargs):
|
||||
return [OutgoingMessage(chat_id=event.chat_id, text="confirmed")]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue