From e978253896676ad52db2461ddbb8f25b34453582 Mon Sep 17 00:00:00 2001 From: Lewdcario Date: Wed, 24 Jan 2018 13:06:05 -0600 Subject: [PATCH] fix(Webhook#send): incorrect docs + return Two things: * Documentation doesn't account for possible raw object return * Allows the return to be a Message object as well, like the docs originally intended --- src/client/rest/RESTMethods.js | 5 ++++- src/structures/Webhook.js | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/client/rest/RESTMethods.js b/src/client/rest/RESTMethods.js index 3b13d1d96..5468030dc 100644 --- a/src/client/rest/RESTMethods.js +++ b/src/client/rest/RESTMethods.js @@ -806,7 +806,10 @@ class RESTMethods { content, tts, embeds, - }, files).then(resolve, reject); + }, files).then(data => { + if (!this.client.channels) resolve(data); + else resolve(this.client.actions.MessageCreate.handle(data).message); + }, reject); } }); } diff --git a/src/structures/Webhook.js b/src/structures/Webhook.js index 1b72530e7..3b5974bee 100644 --- a/src/structures/Webhook.js +++ b/src/structures/Webhook.js @@ -95,7 +95,7 @@ class Webhook { * @param {StringResolvable} content The content to send * @param {WebhookMessageOptions|Attachment|RichEmbed} [options] The options to provide * can also be just a RichEmbed or Attachment - * @returns {Promise} + * @returns {Promise} * @example * // Send a message * webhook.send('hello!')