Kasai
Kasai
DIAdiscord.js - Imagine an app
Created by Kasai on 7/22/2023 in #djs-questions
getTextInputValue not working :C
Yeah it works now. Thanks
49 replies
DIAdiscord.js - Imagine an app
Created by Kasai on 7/22/2023 in #djs-questions
getTextInputValue not working :C
sometimes it's the smallest and dumbest mistakes
49 replies
DIAdiscord.js - Imagine an app
Created by Kasai on 7/22/2023 in #djs-questions
getTextInputValue not working :C
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.
49 replies
DIAdiscord.js - Imagine an app
Created by Kasai on 7/22/2023 in #djs-questions
getTextInputValue not working :C
But the thing is that I have this in my discord. js and not in the package discord-modal. I'm really confused now.
49 replies
DIAdiscord.js - Imagine an app
Created by Kasai on 7/22/2023 in #djs-questions
getTextInputValue not working :C
I will look tomorrow into it again
49 replies
DIAdiscord.js - Imagine an app
Created by Kasai on 7/22/2023 in #djs-questions
getTextInputValue not working :C
Yeah I know but I changed it to offical version I thought
49 replies
DIAdiscord.js - Imagine an app
Created by Kasai on 7/22/2023 in #djs-questions
getTextInputValue not working :C
this here
49 replies
DIAdiscord.js - Imagine an app
Created by Kasai on 7/22/2023 in #djs-questions
getTextInputValue not working :C
I 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
49 replies
DIAdiscord.js - Imagine an app
Created by Kasai on 7/22/2023 in #djs-questions
getTextInputValue not working :C
There is an error in the source code from discord.js
static transformComponent(rawComponent) {
return rawComponent.components.map(c => ({
value: c.value,
type: MessageComponentTypes[c.type],
customId: c.customId, // << was c.custom_id before
}));
}
static transformComponent(rawComponent) {
return rawComponent.components.map(c => ({
value: c.value,
type: MessageComponentTypes[c.type],
customId: c.customId, // << was c.custom_id before
}));
}
https://github.com/discordjs/discord.js/blob/cb11c56a0b93c802b024cc9c8d95250ddf1a5246/src/structures/ModalSubmitInteraction.js#L93 Now TextInputComponent() and getField() get the customId again!
49 replies
DIAdiscord.js - Imagine an app
Created by Kasai on 7/22/2023 in #djs-questions
getTextInputValue not working :C
It doesn't render properly in interaction.fields
49 replies
DIAdiscord.js - Imagine an app
Created by Kasai on 7/22/2023 in #djs-questions
getTextInputValue not working :C
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}
49 replies
DIAdiscord.js - Imagine an app
Created by Kasai on 7/22/2023 in #djs-questions
getTextInputValue not working :C
I used guide from the website (copied and pasted):
onst { MessageActionRow, Modal, TextInputComponent } = require('discord.js');

client.on('interactionCreate', async interaction => {
if (!interaction.isCommand()) return;
if (interaction.commandName === 'ping') {
// Create the modal
const modal = new Modal()
.setCustomId('myModal')
.setTitle('My Modal');
// Add components to modal
// Create the text input components
const favoriteColorInput = new TextInputComponent()
.setCustomId('favoriteColorInput')
// The label is the prompt the user sees for this input
.setLabel("What's your favorite color?")
// Short means only a single line of text
.setStyle('SHORT');
const hobbiesInput = new TextInputComponent()
.setCustomId('hobbiesInput')
.setLabel("What's some of your favorite hobbies?")
// Paragraph means multiple lines of text.
.setStyle('PARAGRAPH');
// An action row only holds one text input,
// so you need one action row per text input.
const firstActionRow = new MessageActionRow().addComponents(favoriteColorInput);
const secondActionRow = new MessageActionRow().addComponents(hobbiesInput);
// Add inputs to the modal
modal.addComponents(firstActionRow, secondActionRow);
// Show the modal to the user
await interaction.showModal(modal);
}
});
onst { MessageActionRow, Modal, TextInputComponent } = require('discord.js');

client.on('interactionCreate', async interaction => {
if (!interaction.isCommand()) return;
if (interaction.commandName === 'ping') {
// Create the modal
const modal = new Modal()
.setCustomId('myModal')
.setTitle('My Modal');
// Add components to modal
// Create the text input components
const favoriteColorInput = new TextInputComponent()
.setCustomId('favoriteColorInput')
// The label is the prompt the user sees for this input
.setLabel("What's your favorite color?")
// Short means only a single line of text
.setStyle('SHORT');
const hobbiesInput = new TextInputComponent()
.setCustomId('hobbiesInput')
.setLabel("What's some of your favorite hobbies?")
// Paragraph means multiple lines of text.
.setStyle('PARAGRAPH');
// An action row only holds one text input,
// so you need one action row per text input.
const firstActionRow = new MessageActionRow().addComponents(favoriteColorInput);
const secondActionRow = new MessageActionRow().addComponents(hobbiesInput);
// Add inputs to the modal
modal.addComponents(firstActionRow, secondActionRow);
// Show the modal to the user
await interaction.showModal(modal);
}
});
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'
49 replies
DIAdiscord.js - Imagine an app
Created by Kasai on 7/22/2023 in #djs-questions
getTextInputValue not working :C
no problem but many people here have this problem in v13
49 replies
DIAdiscord.js - Imagine an app
Created by Kasai on 7/22/2023 in #djs-questions
getTextInputValue not working :C
49 replies
DIAdiscord.js - Imagine an app
Created by Kasai on 7/22/2023 in #djs-questions
getTextInputValue not working :C
49 replies
DIAdiscord.js - Imagine an app
Created by Kasai on 7/22/2023 in #djs-questions
getTextInputValue not working :C
oh sry I forgot :c
49 replies
DIAdiscord.js - Imagine an app
Created by Kasai on 7/22/2023 in #djs-questions
getTextInputValue not working :C
49 replies
DIAdiscord.js - Imagine an app
Created by Kasai on 7/22/2023 in #djs-questions
getTextInputValue not working :C
yeah wait...
49 replies
DIAdiscord.js - Imagine an app
Created by Kasai on 7/22/2023 in #djs-questions
getTextInputValue not working :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
getField(customId) {
const field = this._fields.find(f => f.customId === customId);
if (!field) throw new TypeError('MODAL_SUBMIT_INTERACTION_FIELD_NOT_FOUND', customId);
return field;
}
getField(customId) {
const field = this._fields.find(f => f.customId === customId);
if (!field) throw new TypeError('MODAL_SUBMIT_INTERACTION_FIELD_NOT_FOUND', customId);
return field;
}
And I logged this._fields:
[{"value":"my text","type":"TEXT_INPUT"}]
[{"value":"my text","type":"TEXT_INPUT"}]
49 replies
DIAdiscord.js - Imagine an app
Created by Kasai on 7/22/2023 in #djs-questions
getTextInputValue not working :C
yes :c
49 replies