- msg.isDM is now returned on received messages to help determine if it originated from a direct message room
This commit is contained in:
Skylar Sadlier 2022-03-17 14:30:10 -06:00
parent ac68060825
commit db1901ed1e
2 changed files with 7 additions and 4 deletions

View File

@ -116,6 +116,11 @@
</dd>
</dl>
<dl class="message-properties">
<dt>msg.isDM <span class="property-type">bool</span></dt>
<dd> returns true if message is from a direct message room.</dd>
</dl>
<dl class="message-properties">
<dt>msg.encrypted <span class="property-type">bool</span></dt>
<dd> returns true if message was encrypted (e2ee).</dd>

View File

@ -183,19 +183,17 @@ module.exports = function(RED) {
return allMembers.length <= 2 && isDM;
};
node.matrixClient.getRoom(event.getRoomId())
let msg = {
encrypted : event.isEncrypted(),
redacted : event.isRedacted(),
content : event.getContent(),
type : (event.getContent()['msgtype'] || event.getType()) || null,
payload : (event.getContent()['body'] || event.getContent()) || null,
isDM : isDmRoom(room),
userId : event.getSender(),
topic : event.getRoomId(),
eventId : event.getId(),
event : event,
isDirectMessage: isDmRoom(event.getRoomId())
event : event
};
node.log("Received" + (msg.encrypted ? ' encrypted' : '') +" timeline event [" + msg.type + "]: (" + room.name + ") " + event.getSender() + " :: " + msg.content.body + (toStartOfTimeline ? ' [PAGINATED]' : ''));