For upcoming release of PaginationEmbed v3
FieldsEmbed mode has an extension method formatField which still overrides the field value/s with function for array mapping, however with discordjs/discord.js#4880, now it causes the module to throw out an error due to field value/s being non-string type.
Proposed Solution
formatField will no longer directly pass the arguments to <FieldsEmbed>.embed.fields, instead it will be stored as a property (array of fields) in the current instance of FieldsEmbed and then all formatted fields' functions will be invoked and its output will be passed to <FieldsEmbed>.embed.fields.
This also means that invoking addField first is required.
This will remove inline option in favour of required addField invocation.
Name parameter will be converted to as a field identifier for resolving the desired field and will accept number type for providing the desired field's index. Number type will be added due to the case of different fields with identical field name.
Code Example
New syntax
- formatField(name: string, mapFn: Function, inline: boolean)
+ formatField(nameOrIndex: string | number, mapFn: Function)
Usage
From:
fieldsEmbed.formatField('Occupation', el => el.occupation, true);
To:
fieldsEmbed
.addField('Occupation', 'Could not be loaded', true)
// Or pass `0` instead of `'Occupation'`
.formatField('Occupation', el => el.occupation)
Note: Subject to change
ps. If you got something on your mind regarding this issue, please do not hesitate to post 🥂
ps2. NICE
For upcoming release of PaginationEmbed v3
FieldsEmbedmode has an extension methodformatFieldwhich still overrides the field value/s with function for array mapping, however with discordjs/discord.js#4880, now it causes the module to throw out an error due to field value/s being non-string type.Proposed Solution
formatFieldwill no longer directly pass the arguments to<FieldsEmbed>.embed.fields, instead it will be stored as a property (array of fields) in the current instance ofFieldsEmbedand then all formatted fields' functions will be invoked and its output will be passed to<FieldsEmbed>.embed.fields.This also means that invokingaddFieldfirst is required.This will removeinlineoption in favour of requiredaddFieldinvocation.Nameparameter will be converted to as a field identifier for resolving the desired field and will acceptnumbertype for providing the desired field's index. Number type will be added due to the case of different fields with identical field name.Code ExampleNew syntax
Usage
From:
To:
ps. If you got something on your mind regarding this issue, please do not hesitate to post 🥂
ps2. NICE