Constructor
# new DMs(client)
Creates a new DM map.
Parameters:
Name | Type | Description |
---|---|---|
client |
MatrixClient
|
The client the DM map is for. |
Classes
Methods
# async getOrCreateDm(userId, createFn) → {Promise.<string>}
Gets or creates a DM with a given user. If a DM needs to be created, it will
be created as an encrypted DM (if both the MatrixClient and target user support
crypto). Otherwise, the createFn can be used to override the call. Note that
when creating a DM room the room should have `is_direct: true` set.
Parameters:
Name | Type | Description |
---|---|---|
userId |
string
|
The user ID to get/create a DM for. |
createFn |
function
|
Optional function to use to create the room. Resolves to the created room ID. |
Resolves to the DM room ID.
Promise.<string>
# isDm(roomId) → {boolean}
Determines if a given room is a DM according to the cache.
Parameters:
Name | Type | Description |
---|---|---|
roomId |
string
|
The room ID. |
True if the room ID is a cached DM room ID.
boolean
# async update() → {Promise.<void>}
Forces an update of the DM cache.
Resolves when complete.
Promise.<void>