Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FieldsEmbed Mode Not Working at DJSv13 #69

Open
Tracked by #70
gazmull opened this issue Jul 16, 2021 · 2 comments
Open
Tracked by #70

FieldsEmbed Mode Not Working at DJSv13 #69

gazmull opened this issue Jul 16, 2021 · 2 comments
Assignees
Labels
bug/error Something isn't working/right critical This is important

Comments

@gazmull
Copy link
Owner

gazmull commented Jul 16, 2021

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

@gazmull gazmull added breaking change This may contain significant interface modifications critical This is important labels Jul 16, 2021
@gazmull gazmull self-assigned this Jul 16, 2021
@gazmull gazmull added bug/error Something isn't working/right and removed breaking change This may contain significant interface modifications labels Jul 16, 2021
gazmull added a commit that referenced this issue Aug 3, 2021
@arpanr
Copy link

arpanr commented Aug 18, 2021

any updates on this?

@dudematthew
Copy link

Any quick fix for this? I wan't to just use it with dcjs13 :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug/error Something isn't working/right critical This is important
Projects
None yet
Development

No branches or pull requests

3 participants