mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-10 00:23:30 +01:00
refactor: remove duplicate send checks (#2790)
* re-direct pr code to master * fix Webhook send docs * requested changes * typings: Updated to latest commit * requested change * requested change
This commit is contained in:
@@ -359,7 +359,7 @@ class Message extends Base {
|
||||
|
||||
/**
|
||||
* Edits the content of the message.
|
||||
* @param {StringResolvable} [content=''] The new content for the message
|
||||
* @param {StringResolvable|APIMessage} [content=''] The new content for the message
|
||||
* @param {MessageEditOptions|MessageEmbed} [options] The options to provide
|
||||
* @returns {Promise<Message>}
|
||||
* @example
|
||||
@@ -369,7 +369,9 @@ class Message extends Base {
|
||||
* .catch(console.error);
|
||||
*/
|
||||
edit(content, options) {
|
||||
const data = APIMessage.create(this, content, options).resolveData();
|
||||
const { data } = content instanceof APIMessage ?
|
||||
content.resolveData() :
|
||||
APIMessage.create(this, content, options).resolveData();
|
||||
return this.client.api.channels[this.channel.id].messages[this.id]
|
||||
.patch({ data })
|
||||
.then(d => {
|
||||
@@ -458,7 +460,7 @@ class Message extends Base {
|
||||
|
||||
/**
|
||||
* Replies to the message.
|
||||
* @param {StringResolvable} [content=''] The content for the message
|
||||
* @param {StringResolvable|APIMessage} [content=''] The content for the message
|
||||
* @param {MessageOptions|MessageAdditions} [options={}] The options to provide
|
||||
* @returns {Promise<Message|Message[]>}
|
||||
* @example
|
||||
@@ -468,7 +470,10 @@ class Message extends Base {
|
||||
* .catch(console.error);
|
||||
*/
|
||||
reply(content, options) {
|
||||
return this.channel.send(APIMessage.transformOptions(content, options, { reply: this.member || this.author }));
|
||||
return this.channel.send(content instanceof APIMessage ?
|
||||
content :
|
||||
APIMessage.transformOptions(content, options, { reply: this.member || this.author })
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user