From 86e830de1c5c250cbf7b91dadf581aa384f92360 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9E=97=E5=AE=87=E9=9D=96?= <545641826@qq.com> Date: Sat, 24 Jul 2021 04:01:27 -0400 Subject: [PATCH] can receive files in user contact, but have a problem: --- src/appservice-manager.ts | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/appservice-manager.ts b/src/appservice-manager.ts index fa98441..f23d606 100644 --- a/src/appservice-manager.ts +++ b/src/appservice-manager.ts @@ -134,13 +134,11 @@ export class AppserviceManager extends Manager { switch (message.type()) { case MessageType.Unknown: break - case MessageType.Attachment: - break case MessageType.Audio: break case MessageType.Contact: // image in ipad protocol is Emoticon break - case MessageType.Emoticon: case MessageType.Image: + case MessageType.Emoticon: case MessageType.Image: case MessageType.Attachment: // image in web protocol is Image, in ipad protocol is Emoticon try { const file = await message.toFileBox() @@ -154,9 +152,9 @@ export class AppserviceManager extends Manager { await intent.sendMessage( inRoom.getId(), { - body: 'Image', + body: file.name, info: {}, - msgtype: 'm.image', + msgtype: message.type() === MessageType.Attachment ? 'm.file' : 'm.image', url: url, } )