Getting TextInput Value

https://pastebin.com/gcKrBWYA Line 191 and down is where I am having issues, it keeps saying fields is undefined, but I am not sure how I would define it, as if I use interaction it will tell me it has already replied
Pastebin
const { SlashCommandBuilder, StringSelectMenuBuilder, ActionRowBuil...
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
5 Replies
Unknown User
Unknown User15mo ago
Message Not Public
Sign In & Join Server To View
Baconburger998
Baconburger99815mo ago
discord.js@14.7.1 v18.12.1
.then(console.log(i.fields.getTextInputValue('favoriteColorInput')))
^

TypeError: Cannot read properties of undefined (reading 'getTextInputValue')
at InteractionCollector.<anonymous> (/Users/oerston25/Desktop/custom bot/bot/Commands/Utility/apply.js:205:33)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
.then(console.log(i.fields.getTextInputValue('favoriteColorInput')))
^

TypeError: Cannot read properties of undefined (reading 'getTextInputValue')
at InteractionCollector.<anonymous> (/Users/oerston25/Desktop/custom bot/bot/Commands/Utility/apply.js:205:33)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
i is the ButtonInteraction, which .fields does not exist on. another reason why you're not handling the promises awaitModalSubmit properly with it's resolved values. (someone told me this but im not sure how to fix)
Syjalo
Syjalo15mo ago
awaitModalSubmit returns you a Promise with the ModalSubmitInteraction
Baconburger998
Baconburger99815mo ago
const filter = (i) => i.customId === 'applymodal1'; await i.awaitModalSubmit({ time: 60_000, filter }) .then(() => { Question1Message.edit('Thank you for your submission!') i.fields.getTextInputValue('favoriteColorInput') }) .then((value) => { console.log(value) }) }; like that then?
d.js docs
d.js docs15mo ago
Tag suggestion for @nobcop: Resources to understand Promise: • MDN: learn more • Guide: learn more • JavaScript info: learn more