expose createDM (#1151)

* expose createDM

* Update User.js

* in v12 we are removing these, kay?

* Update GuildMember.js

* Update User.js
This commit is contained in:
Gus Caplan
2017-01-30 21:56:14 -06:00
committed by Schuyler Cebulskie
parent f4724d61b2
commit 8da915f6a1
2 changed files with 17 additions and 1 deletions

View File

@@ -395,12 +395,20 @@ class GuildMember {
return this.edit({ nick });
}
/**
* Creates a DM channel between the client and the member
* @returns {Promise<DMChannel>}
*/
createDM() {
return this.user.createDM();
}
/**
* Deletes any DMs with this guild member
* @returns {Promise<DMChannel>}
*/
deleteDM() {
return this.client.rest.methods.deleteChannel(this);
return this.user.deleteDM();
}
/**

View File

@@ -179,6 +179,14 @@ class User {
return this.client.channels.filter(c => c.type === 'dm').find(c => c.recipient.id === this.id);
}
/**
* Creates a DM channel between the client and the user
* @returns {Promise<DMChannel>}
*/
createDM() {
return this.client.rest.methods.createDM(this);
}
/**
* Deletes a DM channel (if one exists) between the client and the user. Resolves with the channel if successful.
* @returns {Promise<DMChannel>}