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

# There is an error in ModalSubmitInteraction.js #9731

Closed
KasaiKonoru opened this issue Jul 22, 2023 · 5 comments
Closed

# There is an error in ModalSubmitInteraction.js #9731

KasaiKonoru opened this issue Jul 22, 2023 · 5 comments

Comments

@KasaiKonoru
Copy link

KasaiKonoru commented Jul 22, 2023

Which package is this bug report for?

discord.js

Issue description

Always get the MODAL_SUBMIT_INTERACTION_FIELD_NOT_FOUND error because of this failure in code:
interaction.fields.getField() never got the custom ID of the field


"c.custom_id" needs to be "c.customId"
Now TextInputComponent() and getField() get the customId again!

Code sample

static transformComponent(rawComponent) {     
return rawComponent.components.map(c => ({       
value: c.value,       
type: MessageComponentTypes[c.type],       
customId: c.customId, // << was c.custom_id before     })); 
}
//Now TextInputComponent() and getField() get the customId again!

Versions

[email protected]
Node: v18.15.0

Issue priority

Medium (should be fixed soon)

Which partials do you have configured?

Not applicable

Which gateway intents are you subscribing to?

Not applicable

I have tested this issue on a development release

No response

@KasaiKonoru KasaiKonoru changed the title # There is an error in the source code from discord.js # There is an error in ModalSubmitInteraction.js Jul 22, 2023
@Jiralite
Copy link
Member

Jiralite commented Jul 22, 2023

I cannot reproduce this issue. My code sample is actually simply copied from the version 13 guide.

Moreover, this seems to be impossible. This method is referenced in one place only:

/**
* The inputs within the modal
* @type {PartialModalActionRow[]}
*/
this.components =
data.data.components?.map(c => ({
type: MessageComponentTypes[c.type],
components: ModalSubmitInteraction.transformComponent(c),
})) ?? [];

c is raw data, so custom_id is the correct property to use.


The more likely scenario is you are doing something incorrectly or the internal behaviour of discord.js has been edited (especially since this has not changed since implementation and no one has complained).

@Jiralite Jiralite closed this as not planned Won't fix, can't repro, duplicate, stale Jul 22, 2023
@KasaiKonoru
Copy link
Author

ok thanks. But many people in the discord server have this issue. I reinstalled discord v13 and used a new bot with the guide copied and pasted. But I always get the same error

@KasaiKonoru
Copy link
Author

KasaiKonoru commented Jul 22, 2023

the textinput was only logged without error when I modified c.custom_id to c.customId

@Jiralite
Copy link
Member

Jiralite commented Jul 22, 2023

But many people in the discord server have this issue.

I have a hard time believing that, considering modal support was added over a year ago, I cannot reproduce this, and this code has been untouched. Care to link these many people in the server?

@Jiralite
Copy link
Member

From Discord, it was found that the reporter had a third-party package installed which modified the internal behaviour of discord.js resulting in this error (posting for transparency).

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 24, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants