mirror of
https://github.com/danbulant/discord.js
synced 2026-05-27 14:02:02 +00:00
fix message embed json serialization (#2420)
* fix message embed json serialization remove the toJSON method on message embeds so the raw data is exposed for JSON seralization. this removes the hexColor property, but it probably should not have been there in the first place. fixes #2419 * change api transform to tojson
This commit is contained in:
parent
4e0e64d8a1
commit
c40488eb54
2 changed files with 4 additions and 9 deletions
|
|
@ -302,16 +302,11 @@ 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
|
||||
*/
|
||||
_apiTransform() {
|
||||
toJSON() {
|
||||
return {
|
||||
title: this.title,
|
||||
type: 'rich',
|
||||
|
|
|
|||
|
|
@ -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)._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());
|
||||
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));
|
||||
|
||||
let files;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue