diff --git a/src/client/rest/RESTMethods.js b/src/client/rest/RESTMethods.js index 5843e2908..59f3c65ae 100644 --- a/src/client/rest/RESTMethods.js +++ b/src/client/rest/RESTMethods.js @@ -152,7 +152,7 @@ class RESTMethods { content = `${mention}${content ? `, ${content}` : ''}`; } - if (embed instanceof RichEmbed) embed = embed._apiTransform(); + if (embed instanceof RichEmbed) embed = embed.toJSON(); return this.rest.makeRequest('patch', Endpoints.Message(message), true, { content, embed, flags, diff --git a/src/structures/RichEmbed.js b/src/structures/RichEmbed.js index b4083501d..5ccb22dee 100644 --- a/src/structures/RichEmbed.js +++ b/src/structures/RichEmbed.js @@ -278,11 +278,10 @@ class RichEmbed { } /** - * Transforms the embed object to be processed. + * Transforms the embed to a plain object. * @returns {Object} The raw data of this embed - * @private */ - _apiTransform() { + toJSON() { return { title: this.title, type: 'rich', diff --git a/src/structures/Webhook.js b/src/structures/Webhook.js index ca3cb9533..5d82b0c4f 100644 --- a/src/structures/Webhook.js +++ b/src/structures/Webhook.js @@ -227,7 +227,7 @@ class Webhook extends EventEmitter { else options.files = files; } - if (options.embeds) options.embeds = options.embeds.map(e => new RichEmbed(e)._apiTransform()); + if (options.embeds) options.embeds = options.embeds.map(e => new RichEmbed(e).toJSON()); if (options.files) { for (let i = 0; i < options.files.length; i++) { diff --git a/src/structures/interfaces/TextBasedChannel.js b/src/structures/interfaces/TextBasedChannel.js index 20230302c..ceaa73b17 100644 --- a/src/structures/interfaces/TextBasedChannel.js +++ b/src/structures/interfaces/TextBasedChannel.js @@ -147,7 +147,7 @@ class TextBasedChannel { else options.files = [options.file]; } - if (options.embed) options.embed = new RichEmbed(options.embed)._apiTransform(); + if (options.embed) options.embed = new RichEmbed(options.embed).toJSON(); if (options.files) { for (let i = 0; i < options.files.length; i++) { diff --git a/typings/index.d.ts b/typings/index.d.ts index 104a99037..b8353d66f 100644 --- a/typings/index.d.ts +++ b/typings/index.d.ts @@ -1120,8 +1120,6 @@ declare module 'discord.js' { export class RichEmbed { constructor(data?: RichEmbedOptions | MessageEmbed); - private _apiTransform(): object; - public author?: { name: string; url?: string; icon_url?: string; }; public color?: number; public description?: string;