mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-18 20:43:30 +01:00
fix(Message): keep reply option when using an embed or attachment
See #2651
This commit is contained in:
@@ -20,7 +20,7 @@ module.exports = async function createMessage(channel, options) {
|
|||||||
if (isNaN(options.nonce) || options.nonce < 0) throw new RangeError('MESSAGE_NONCE_TYPE');
|
if (isNaN(options.nonce) || options.nonce < 0) throw new RangeError('MESSAGE_NONCE_TYPE');
|
||||||
}
|
}
|
||||||
|
|
||||||
let { content } = options;
|
let { content, reply } = options;
|
||||||
if (options instanceof MessageEmbed) options = webhook ? { embeds: [options] } : { embed: options };
|
if (options instanceof MessageEmbed) options = webhook ? { embeds: [options] } : { embed: options };
|
||||||
if (options instanceof MessageAttachment) options = { files: [options.file] };
|
if (options instanceof MessageAttachment) options = { files: [options.file] };
|
||||||
|
|
||||||
@@ -36,9 +36,9 @@ module.exports = async function createMessage(channel, options) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (options.reply && !(channel instanceof User || channel instanceof GuildMember) && channel.type !== 'dm') {
|
if (reply && !(channel instanceof User || channel instanceof GuildMember) && channel.type !== 'dm') {
|
||||||
const id = channel.client.users.resolveID(options.reply);
|
const id = channel.client.users.resolveID(reply);
|
||||||
const mention = `<@${options.reply instanceof GuildMember && options.reply.nickname ? '!' : ''}${id}>`;
|
const mention = `<@${reply instanceof GuildMember && reply.nickname ? '!' : ''}${id}>`;
|
||||||
if (options.split) options.split.prepend = `${mention}, ${options.split.prepend || ''}`;
|
if (options.split) options.split.prepend = `${mention}, ${options.split.prepend || ''}`;
|
||||||
content = `${mention}${typeof options.content !== 'undefined' ? `, ${options.content}` : ''}`;
|
content = `${mention}${typeof options.content !== 'undefined' ? `, ${options.content}` : ''}`;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user