feat(MessageEmbed): Support EmbedFieldData[] instead of EmbedFi… (#3845)

* fix(typings): MessageEmbedOptions#fields should be EmbedFieldData[]

* feat(MessageEmbed): Allow optional EmbedFieldData#inline in constructor

* docs(MessageEmbed): revert type change of fields

Co-authored-by: Crawl <icrawltogo@gmail.com>
Co-authored-by: SpaceEEC <spaceeec@yahoo.com>
This commit is contained in:
Ryan Munro
2020-03-01 00:21:43 +11:00
committed by GitHub
parent 9c8aaf1bbc
commit 6650d50a56
2 changed files with 2 additions and 2 deletions

View File

@@ -65,7 +65,7 @@ class MessageEmbed {
* The fields of this embed * The fields of this embed
* @type {EmbedField[]} * @type {EmbedField[]}
*/ */
this.fields = data.fields ? data.fields.map(Util.cloneObject) : []; this.fields = data.fields ? this.constructor.normalizeFields(data.fields) : [];
/** /**
* @typedef {Object} MessageEmbedThumbnail * @typedef {Object} MessageEmbedThumbnail

2
typings/index.d.ts vendored
View File

@@ -2469,7 +2469,7 @@ declare module 'discord.js' {
url?: string; url?: string;
timestamp?: Date | number; timestamp?: Date | number;
color?: ColorResolvable; color?: ColorResolvable;
fields?: EmbedField[]; fields?: EmbedFieldData[];
files?: (MessageAttachment | string | FileOptions)[]; files?: (MessageAttachment | string | FileOptions)[];
author?: Partial<MessageEmbedAuthor> & { icon_url?: string; proxy_icon_url?: string; }; author?: Partial<MessageEmbedAuthor> & { icon_url?: string; proxy_icon_url?: string; };
thumbnail?: Partial<MessageEmbedThumbnail> & { proxy_url?: string; }; thumbnail?: Partial<MessageEmbedThumbnail> & { proxy_url?: string; };