Allow creating a MemoChat from Matrix by inviting own puppet to DM

WARNING: Seems to always fail with -203 (Invalid body)
This commit is contained in:
Andrew Ferrazzutti 2022-05-10 01:06:42 -04:00
parent 36598c34f6
commit 45fdd5ca29

View File

@ -1135,10 +1135,16 @@ export default class PeerClient {
* @param {Long} req.user_id * @param {Long} req.user_id
*/ */
createDirectChat = async (req) => { createDirectChat = async (req) => {
const channelList = this.#getUser(req.mxid).talkClient.channelList.normal const userClient = this.#getUser(req.mxid)
const res = await channelList.createChannel({ const channelList = userClient.talkClient.channelList.normal
const res =
req.user_id != userClient.userId
? await channelList.createChannel({
userList: [{ userId: req.user_id }], userList: [{ userId: req.user_id }],
}) })
: await channelList.createMemoChannel()
if (!res.success) return res if (!res.success) return res
return makeCommandResult(res.result.channelId) return makeCommandResult(res.result.channelId)
} }