mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-09 16:13:31 +01:00
Add Message.fetchWebhook (#947)
* Add Message.fetchWebhook * Update Message.js
This commit is contained in:
committed by
Schuyler Cebulskie
parent
c0aa6bd30f
commit
8b7ef0c850
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user