src: Update Webhook#sendSlackMessage to be accurate with what the API returns (#3429)

* src: Update sendSlackMessage

* typings
This commit is contained in:
Vlad Frangu
2019-08-19 23:02:33 +03:00
committed by Amish Shah
parent e4309b23d5
commit fbd811517a
2 changed files with 3 additions and 7 deletions

View File

@@ -155,7 +155,7 @@ class Webhook {
/**
* Sends a raw slack message with this webhook.
* @param {Object} body The raw body to send
* @returns {Promise<Message|Object>}
* @returns {Promise<boolean>}
* @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');
}
/**