Add Message.fetchWebhook (#947)

* Add Message.fetchWebhook

* Update Message.js
This commit is contained in:
Programmix
2016-12-02 19:59:44 -08:00
committed by Schuyler Cebulskie
parent c0aa6bd30f
commit 8b7ef0c850

View File

@@ -479,6 +479,15 @@ class Message {
return this.client.rest.methods.sendMessage(this.channel, content, options);
}
/**
* Fetches the webhook used to create this message.
* @returns {Promise<?Webhook>}
*/
fetchWebhook() {
if (!this.webhookID) return Promise.reject(new Error('The message was not sent by a webhook.'));
return this.client.fetchWebhook(this.webhookID);
}
/**
* Used mainly internally. Whether two messages are identical in properties. If you want to compare messages
* without checking all the properties, use `message.id === message2.id`, which is much more efficient. This