Would be nice to return in the msg object whether it came from a direct message room or not.
Here is some code someone posted in the matrix-dev room to do just this:
const isDmRoom = (room) => {
// Find out if this is a direct message room.
let isDM = room.getDMInviter() ? true : false;
const allMembers = room.currentState.getMembers();
if (!isDM && allMembers.length <= 2) {
// if not a DM, but there are 2 users only
// double check DM (needed because getDMInviter works only if you were invited, not if you invite)
// hence why we check for each member
if (allMembers.some((m) => m.getDMInviter())) {
return true;
}
}
return allMembers.length <= 2 && isDM;
};
Would be nice to return in the
msg
object whether it came from a direct message room or not.Here is some code someone posted in the
matrix-dev
room to do just this:Performance will need to be tested.