From 526832058e78de8d8936e8db61b60775a0bcf3a5 Mon Sep 17 00:00:00 2001 From: SpaceEEC Date: Sun, 8 Jul 2018 21:12:30 +0200 Subject: [PATCH] fix(Message): keep reply option when using an embed or attachment See #2651 --- src/structures/shared/CreateMessage.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/structures/shared/CreateMessage.js b/src/structures/shared/CreateMessage.js index 55d779cf5..ee9756f77 100644 --- a/src/structures/shared/CreateMessage.js +++ b/src/structures/shared/CreateMessage.js @@ -20,7 +20,7 @@ module.exports = async function createMessage(channel, options) { 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 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') { - const id = channel.client.users.resolveID(options.reply); - const mention = `<@${options.reply instanceof GuildMember && options.reply.nickname ? '!' : ''}${id}>`; + if (reply && !(channel instanceof User || channel instanceof GuildMember) && channel.type !== 'dm') { + const id = channel.client.users.resolveID(reply); + const mention = `<@${reply instanceof GuildMember && reply.nickname ? '!' : ''}${id}>`; if (options.split) options.split.prepend = `${mention}, ${options.split.prepend || ''}`; content = `${mention}${typeof options.content !== 'undefined' ? `, ${options.content}` : ''}`; }