From 1e90d2b7722c25cb80bbaac02755f52188fb81d4 Mon Sep 17 00:00:00 2001 From: gazmull Date: Tue, 3 Aug 2021 20:54:13 +0800 Subject: [PATCH] Fix(FieldsEmbed): Strict field strings only - Fixes #69 Signed-off-by: gazmull --- src/FieldsEmbed.ts | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/FieldsEmbed.ts b/src/FieldsEmbed.ts index 07322b6..e19bee8 100644 --- a/src/FieldsEmbed.ts +++ b/src/FieldsEmbed.ts @@ -84,10 +84,7 @@ export class FieldsEmbed extends PaginationEmbed { this.embed.fields = []; for (const field of fields) - if (typeof field.value === 'function') - this.formatField(field.name, field.value, field.inline); - else - this.embed.addField(field.name, field.value, field.inline); + this.embed.fields.push(field); const hasPaginateField = this.embed.fields.filter(f => typeof f.value === 'function').length; @@ -127,10 +124,12 @@ export class FieldsEmbed extends PaginationEmbed { } protected async _drawList () { + const fields = this.embed.fields; + this.embed.fields = []; const embed = new MessageEmbed(this.embed); - embed.fields = []; + this.embed.fields = fields; - for (const field of this.embed.fields) + for (const field of fields) embed.addField( field.name, typeof field.value === 'function'