From 45fdd5ca2954636d1cf61b5a66ccc18d8a068b8d Mon Sep 17 00:00:00 2001 From: Andrew Ferrazzutti Date: Tue, 10 May 2022 01:06:42 -0400 Subject: [PATCH] Allow creating a MemoChat from Matrix by inviting own puppet to DM WARNING: Seems to always fail with -203 (Invalid body) --- node/src/client.js | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/node/src/client.js b/node/src/client.js index af913f4..abba74f 100644 --- a/node/src/client.js +++ b/node/src/client.js @@ -1135,10 +1135,16 @@ export default class PeerClient { * @param {Long} req.user_id */ createDirectChat = async (req) => { - const channelList = this.#getUser(req.mxid).talkClient.channelList.normal - const res = await channelList.createChannel({ - userList: [{ userId: req.user_id }], - }) + const userClient = this.#getUser(req.mxid) + const channelList = userClient.talkClient.channelList.normal + + const res = + req.user_id != userClient.userId + ? await channelList.createChannel({ + userList: [{ userId: req.user_id }], + }) + : await channelList.createMemoChannel() + if (!res.success) return res return makeCommandResult(res.result.channelId) }