Class

DMs

DMs(client)

Handles DM (direct messages) matching between users. Note that bots which existed prior to this might not have DM rooms populated correctly - the account data can be populated externally and that will be reflected here. Note that DM status is persisted across all access tokens for a user and is not persisted with the regular stores. The DM map is instead tracked on the homeserver as account data and thus survives the bot's own storage being wiped.
Constructor

# new DMs(client)

Creates a new DM map.
Parameters:
Name Type Description
client MatrixClient The client the DM map is for.

View Source DMs.ts, line 15

Classes

DMs
DMs

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.

View Source DMs.ts, line 193

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.

View Source DMs.ts, line 201

True if the room ID is a cached DM room ID.
boolean

# async update() → {Promise.<void>}

Forces an update of the DM cache.

View Source DMs.ts, line 179

Resolves when complete.
Promise.<void>