From 84503c88771de8914ecd7400fe5a6a339e3e0632 Mon Sep 17 00:00:00 2001 From: Gus Caplan Date: Tue, 20 Dec 2016 17:36:43 -0600 Subject: [PATCH] add User#dmChannel (#1005) * add User#DMChannel * Update User.js * Update User.js --- src/structures/User.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/structures/User.js b/src/structures/User.js index ae046159..7c19bef1 100644 --- a/src/structures/User.js +++ b/src/structures/User.js @@ -164,6 +164,14 @@ class User { return channel._typing.has(this.id) ? channel._typing.get(this.id).elapsedTime : -1; } + /** + * The DM between the client's user and this user + * @type {?DMChannel} + */ + get dmChannel() { + return this.client.channels.filter(c => c.type === 'dm').find(c => c.recipient.id === this.id); + } + /** * Deletes a DM channel (if one exists) between the client and the user. Resolves with the channel if successful. * @returns {Promise}