diff --git a/src/structures/MessageEmbed.js b/src/structures/MessageEmbed.js index 66f087220..7cfb6d1aa 100644 --- a/src/structures/MessageEmbed.js +++ b/src/structures/MessageEmbed.js @@ -216,7 +216,7 @@ class MessageEmbed { /** * Adds a fields to the embed (max 25). - * @param {...EmbedField|EmbedField[]} fields The fields to add + * @param {...EmbedFieldData|EmbedFieldData[]} fields The fields to add * @returns {MessageEmbed} */ addFields(...fields) { @@ -228,7 +228,7 @@ class MessageEmbed { * Removes, replaces, and inserts fields in the embed (max 25). * @param {number} index The index to start at * @param {number} deleteCount The number of fields to remove - * @param {...EmbedField|EmbedField[]} [fields] The replacing field objects + * @param {...EmbedFieldData|EmbedFieldData[]} [fields] The replacing field objects * @returns {MessageEmbed} */ spliceFields(index, deleteCount, ...fields) { @@ -386,9 +386,16 @@ class MessageEmbed { return { name, value, inline }; } + /** + * @typedef {Object} EmbedFieldData + * @property {StringResolvable} name The name of this field + * @property {StringResolvable} value The value of this field + * @property {boolean} [inline] If this field will be displayed inline + */ + /** * Check for valid field input and resolves strings - * @param {...EmbedField|EmbedField[]} fields Fields to normalize + * @param {...EmbedFieldData|EmbedFieldData[]} fields Fields to normalize * @returns {EmbedField[]} */ static normalizeFields(...fields) { diff --git a/typings/index.d.ts b/typings/index.d.ts index d3c1d5b8c..2bff7f52f 100644 --- a/typings/index.d.ts +++ b/typings/index.d.ts @@ -1068,7 +1068,7 @@ declare module 'discord.js' { public type: string; public url?: string; public readonly video: MessageEmbedVideo | null; - public addFields(...fields: EmbedField[] | EmbedField[][]): this; + public addFields(...fields: EmbedFieldData[] | EmbedFieldData[][]): this; public attachFiles(file: (MessageAttachment | FileOptions | string)[]): this; public setAuthor(name: StringResolvable, iconURL?: string, url?: string): this; public setColor(color: ColorResolvable): this; @@ -1079,11 +1079,11 @@ declare module 'discord.js' { public setTimestamp(timestamp?: Date | number): this; public setTitle(title: StringResolvable): this; public setURL(url: string): this; - public spliceFields(index: number, deleteCount: number, ...fields: EmbedField[] | EmbedField[][]): this; + public spliceFields(index: number, deleteCount: number, ...fields: EmbedFieldData[] | EmbedFieldData[][]): this; public toJSON(): object; - public static normalizeField(name: StringResolvable, value: StringResolvable, inline?: boolean): Required; - public static normalizeFields(...fields: EmbedField[] | EmbedField[][]): Required[]; + public static normalizeField(name: StringResolvable, value: StringResolvable, inline?: boolean): Required; + public static normalizeFields(...fields: EmbedFieldData[] | EmbedFieldData[][]): Required[]; } export class MessageMentions { @@ -2184,6 +2184,12 @@ declare module 'discord.js' { interface EmbedField { name: string; value: string; + inline: boolean; + } + + interface EmbedFieldData { + name: StringResolvable; + value: StringResolvable; inline?: boolean; }