add User#dmChannel (#1005)

* add User#DMChannel

* Update User.js

* Update User.js
This commit is contained in:
Gus Caplan
2016-12-20 17:36:43 -06:00
committed by Amish Shah
parent e392107369
commit 84503c8877

View File

@@ -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<DMChannel>}