From 8da915f6a1190624de45d746d842124dfca8c5bc Mon Sep 17 00:00:00 2001 From: Gus Caplan Date: Mon, 30 Jan 2017 21:56:14 -0600 Subject: [PATCH] expose createDM (#1151) * expose createDM * Update User.js * in v12 we are removing these, kay? * Update GuildMember.js * Update User.js --- src/structures/GuildMember.js | 10 +++++++++- src/structures/User.js | 8 ++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/structures/GuildMember.js b/src/structures/GuildMember.js index af3c5be30..79dd91fc7 100644 --- a/src/structures/GuildMember.js +++ b/src/structures/GuildMember.js @@ -395,12 +395,20 @@ class GuildMember { return this.edit({ nick }); } + /** + * Creates a DM channel between the client and the member + * @returns {Promise} + */ + createDM() { + return this.user.createDM(); + } + /** * Deletes any DMs with this guild member * @returns {Promise} */ deleteDM() { - return this.client.rest.methods.deleteChannel(this); + return this.user.deleteDM(); } /** diff --git a/src/structures/User.js b/src/structures/User.js index 94dbd4883..939d3f157 100644 --- a/src/structures/User.js +++ b/src/structures/User.js @@ -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} + */ + 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}