From fbd811517a298b857f9fd963d8fb13c4c1207f90 Mon Sep 17 00:00:00 2001 From: Vlad Frangu Date: Mon, 19 Aug 2019 23:02:33 +0300 Subject: [PATCH] src: Update Webhook#sendSlackMessage to be accurate with what the API returns (#3429) * src: Update sendSlackMessage * typings --- src/structures/Webhook.js | 8 ++------ typings/index.d.ts | 2 +- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/src/structures/Webhook.js b/src/structures/Webhook.js index 2dc1a0282..2ed6137b4 100644 --- a/src/structures/Webhook.js +++ b/src/structures/Webhook.js @@ -155,7 +155,7 @@ class Webhook { /** * Sends a raw slack message with this webhook. * @param {Object} body The raw body to send - * @returns {Promise} + * @returns {Promise} * @example * // Send a slack message * webhook.sendSlackMessage({ @@ -174,11 +174,7 @@ class Webhook { query: { wait: true }, auth: false, data: body, - }).then(d => { - const channel = this.client.channels ? this.client.channels.get(d.channel_id) : undefined; - if (!channel) return d; - return channel.messages.add(d, false); - }); + }).then(data => data.toString() === 'ok'); } /** diff --git a/typings/index.d.ts b/typings/index.d.ts index 0bc65d4e5..72ee1e893 100644 --- a/typings/index.d.ts +++ b/typings/index.d.ts @@ -1861,7 +1861,7 @@ declare module 'discord.js' { send(content?: StringResolvable, options?: WebhookMessageOptions & { split: true | SplitOptions } | MessageAdditions): Promise; send(options?: WebhookMessageOptions & { split?: false } | MessageAdditions | APIMessage): Promise; send(options?: WebhookMessageOptions & { split: true | SplitOptions } | MessageAdditions | APIMessage): Promise; - sendSlackMessage(body: object): Promise; + sendSlackMessage(body: object): Promise; } //#endregion