#TypeError: Cannot read properties of undefined (reading 'getTextInputValue')

7 messages · Page 1 of 1 (latest)

clever grotto
#

• 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.

elder silo
#
const ticket_modal_nickname1 = await interaction.fields.getTextInputValue('ticket_modal_nickname');

Some interaction types do not have a .fields property so interaction.fields may be undefined. Use type guards so that this only gets checked for modal submit interactions

#

Also it doesn't need to be awaited because it's not a Promise

#

You don't have to replace it, just don't try to use it unless you check whether the interaction is a modal first

#

Yes it will work if the interaction is a modal

#

Yep, that's the correct type guard

#

Then the code isn't running or the interaction isn't a modal