28 Replies
- What's your exact discord.js
npm list discord.js
and node node -v
version?
- Post the full error stack trace, not just the top part!
- Show your code!
- Explain what exactly your issue is.
- Not a discord.js issue? Check out #useful-servers.
- Issue solved? Press the button!Unknown User•17mo ago
Message Not Public
Sign In & Join Server To View
This is working, but Why I cant use: interaction.fields.getTextInputValue('request_name'); Im still getting this error: "TypeError [MODAL_SUBMIT_INTERACTION_FIELD_NOT_FOUND]: Required field with custom id "request_name" not found."
const modal_data = new Modal()
.setCustomId('modalrequest')
.setTitle('Add something to Queue!')
.addComponents(new MessageActionRow()
.addComponents(
new TextInputComponent()
.setCustomId('request_name')
.setLabel("I want to add:")
.setStyle('SHORT')
.setMinLength(3)
.setMaxLength(150)
.setPlaceholder("Enter title or url here..")
.setRequired(true)
));
await interaction.showModal(modal_data);
yeah... isModalSubmit() is true for me
Unknown User•17mo ago
Message Not Public
Sign In & Join Server To View
no I want to get the value.
Unknown User•17mo ago
Message Not Public
Sign In & Join Server To View
yeah now Im only stuck with the
interaction.fields.getTextInputValue("field_custom_id")
Unknown User•17mo ago
Message Not Public
Sign In & Join Server To View
Dont wonder. Its in an extra file.
the other file:
I only have one modal so I dont need to check the customid for Submit Interaction
Unknown User•17mo ago
Message Not Public
Sign In & Join Server To View
yes :c
the problem is this in the source code from discod.js:
I checked the source code and logged "interaction.fields":
{"components":[{"type":"ACTION_ROW","components":[{"value":"fghfhfghfghhgjgh","type":"TEXT_INPUT"}]}]}
and there is no customId property
And I logged this._fields
:
Unknown User•17mo ago
Message Not Public
Sign In & Join Server To View
yeah wait...
Unknown User•17mo ago
Message Not Public
Sign In & Join Server To View
oh sry I forgot :c
https://github.com/discordjs/discord.js/blob/cb11c56a0b93c802b024cc9c8d95250ddf1a5246/src/structures/ModalSubmitFieldsResolver.js#L33C1-L33C1
Here is the line. But there is not "customId" as property in the object with the Text input
Unknown User•17mo ago
Message Not Public
Sign In & Join Server To View
no problem but many people here have this problem in v13
I used guide from the website (copied and pasted):
Always the same error:
Error: I can't find this field
1|BITWAVE | at ModalSubmitFieldsResolver.getTextInputValue (/root/01-FILES/discord-bots/bitwave/node_modules/discord-modal/ModalSubmitFieldsResolver.js:18:50)
1|BITWAVE | at Client.<anonymous> (/root/01-FILES/discord-bots/bitwave/handlers/extraevents.js:233:68)
1|BITWAVE | at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
1|BITWAVE |
1|BITWAVE | === UNHANDLED REJECTION ===
1|BITWAVE | Reason:
1|BITWAVE | === UNHANDLED REJECTION ===
1|BITWAVE |
1|BITWAVE | TypeError [MODAL_SUBMIT_INTERACTION_FIELD_NOT_FOUND]: Required field with custom id "test" not found.
1|BITWAVE | at ModalSubmitFieldsResolver.getField (/root/01-FILES/discord-bots/bitwave/node_modules/discord.js/src/structures/ModalSubmitFieldsResolver.js:34:23)
1|BITWAVE | at ModalSubmitFieldsResolver.getTextInputValue (/root/01-FILES/discord-bots/bitwave/node_modules/discord.js/src/structures/ModalSubmitFieldsResolver.js:44:24)
1|BITWAVE | at module.exports (/root/01-FILES/discord-bots/bitwave/handlers/erela_events/modal_interactions.js:32:46)
1|BITWAVE | at Client.<anonymous> (/root/01-FILES/discord-bots/bitwave/handlers/erela_events/musicsystem.js:36:79)
1|BITWAVE | at Client.emit (node:events:525:35)
1|BITWAVE | at Client.emit (node:domain:489:12)
1|BITWAVE | at InteractionCreateAction.handle (/root/01-FILES/discord-bots/bitwave/node_modules/discord.js/src/client/actions/InteractionCreate.js:83:12)
1|BITWAVE | at module.exports [as INTERACTION_CREATE] (/root/01-FILES/discord-bots/bitwave/node_modules/discord.js/src/client/websocket/handlers/INTERACTION_CREATE.js:4:36)
1|BITWAVE | at WebSocketManager.handlePacket (/root/01-FILES/discord-bots/bitwave/node_modules/discord.js/src/client/websocket/WebSocketManager.js:346:31)
1|BITWAVE | at WebSocketShard.onPacket (/root/01-FILES/discord-bots/bitwave/node_modules/discord.js/src/client/websocket/WebSocketShard.js:493:22) {
1|BITWAVE | [Symbol(code)]: 'MODAL_SUBMIT_INTERACTION_FIELD_NOT_FOUND'
I logged the: "TextInputComponent" and the output is: {"custom_id":"test","label":"What's your favorite color?","max_length":null,"min_length":null,"placeholder":null,"required":false,"style":1,"type":4,"value":null}
It doesn't render properly in interaction.fieldsThere is an error in the source code from discord.js
https://github.com/discordjs/discord.js/blob/cb11c56a0b93c802b024cc9c8d95250ddf1a5246/src/structures/ModalSubmitInteraction.js#L93
Now TextInputComponent() and getField() get the customId again!
GitHub
discord.js/src/structures/ModalSubmitInteraction.js at cb11c56a0b93...
A powerful JavaScript library for interacting with the Discord API - discordjs/discord.js
that's not a typo
that function should only be receiving the raw component data from discord, and the discord api uses snake_case
at no point should that data contain the property
customId
unless either discord had an issue, or if other discord.js internal source was modified
I am unable to reproduce any behavior requiring the change you've providedI dont have my pc now here but I also tried a new bot with one file with the discord js guide and copied & pasted it
this here
Unknown User•17mo ago
Message Not Public
Sign In & Join Server To View
Yeah I know but I changed it to offical version I thought
I will look tomorrow into it again
But the thing is that I have this in my discord. js and not in the package discord-modal. I'm really confused now.
oh lol I think I got it in my brain before sleeping xD
the initialize with DiscordModal(client) was still active and I forgot to disable it. Sry. I will try this tomorrow. But thanks for your help.
sometimes it's the smallest and dumbest mistakes
Yeah it works now. Thanks