diff --git a/src/structures/MessageEmbed.js b/src/structures/MessageEmbed.js index 5f84563bc..82d930eda 100644 --- a/src/structures/MessageEmbed.js +++ b/src/structures/MessageEmbed.js @@ -302,11 +302,16 @@ class MessageEmbed { return this; } + toJSON() { + return Util.flatten(this, { hexColor: true }); + } + /** * Transforms the embed object to be processed. * @returns {Object} The raw data of this embed + * @private */ - toJSON() { + _apiTransform() { return { title: this.title, type: 'rich', diff --git a/src/structures/shared/CreateMessage.js b/src/structures/shared/CreateMessage.js index ea83618ac..55d779cf5 100644 --- a/src/structures/shared/CreateMessage.js +++ b/src/structures/shared/CreateMessage.js @@ -71,9 +71,9 @@ module.exports = async function createMessage(channel, options) { else options.files = options.embed.files; } - if (options.embed && webhook) options.embeds = [new Embed(options.embed)]; - else if (options.embed) options.embed = new Embed(options.embed); - else if (options.embeds) options.embeds = options.embeds.map(e => new Embed(e)); + if (options.embed && webhook) options.embeds = [new Embed(options.embed)._apiTransform()]; + else if (options.embed) options.embed = new Embed(options.embed)._apiTransform(); + else if (options.embeds) options.embeds = options.embeds.map(e => new Embed(e)._apiTransform()); let files;