fix(MessageEmbed): prevent possible destructuring error

This commit is contained in:
Bence
2020-02-29 14:19:56 +01:00
committed by GitHub
parent e4f567c65e
commit bbe169deac

View File

@@ -411,7 +411,13 @@ class MessageEmbed {
* @returns {EmbedField[]} * @returns {EmbedField[]}
*/ */
static normalizeFields(...fields) { static normalizeFields(...fields) {
return fields.flat(2).map(({ name, value, inline }) => this.normalizeField(name, value, inline)); return fields.flat(2).map(field =>
this.normalizeField(
field && field.name,
field && field.value,
field && typeof field.inline === 'boolean' ? field.inline : false,
),
);
} }
} }