Can't send modals ( An error occured )

Hi, i'm getting an error while sending modals code:
if(interaction.type === InteractionType.ModalSubmit) {
console.log(interaction)
if((interaction as ModalSubmitInteraction).customId === "modal-contact-admin") {
console.log((interaction as ModalSubmitInteraction).fields.getField("modal-input-admin").value)
}
if(interaction.type === InteractionType.ModalSubmit) {
console.log(interaction)
if((interaction as ModalSubmitInteraction).customId === "modal-contact-admin") {
console.log((interaction as ModalSubmitInteraction).fields.getField("modal-input-admin").value)
}
Error : An error occured | directly on the modal I receive the interaction correctly, seems he cant handle it.
24 Replies
d.js toolkit
d.js toolkit3mo ago
- What's your exact discord.js npm list discord.js and node node -v version? - Not a discord.js issue? Check out #other-js-ts. - Consider reading #how-to-get-help to improve your question! - Explain what exactly your issue is. - Post the full error stack trace, not just the top part! - Show your code! - Issue solved? Press the button! - Marked as resolved by OP
kps
kpsOP3mo ago
No description
treble/luna
treble/luna3mo ago
and where do you reply to the interaction
kps
kpsOP3mo ago
interactionCreate. I just console log values for the moment.
treble/luna
treble/luna3mo ago
show that code then
kps
kpsOP3mo ago
You got it, it's on the post
if(interaction.type === InteractionType.ModalSubmit) {
console.log(interaction)
if((interaction as ModalSubmitInteraction).customId === "modal-contact-admin") {
console.log((interaction as ModalSubmitInteraction).fields.getField("modal-input-admin").value)
}
if(interaction.type === InteractionType.ModalSubmit) {
console.log(interaction)
if((interaction as ModalSubmitInteraction).customId === "modal-contact-admin") {
console.log((interaction as ModalSubmitInteraction).fields.getField("modal-input-admin").value)
}
Unknown User
Unknown User3mo ago
Message Not Public
Sign In & Join Server To View
kps
kpsOP3mo ago
As there's no reply, if I just log values, it won't respond ?
treble/luna
treble/luna3mo ago
yes
kps
kpsOP3mo ago
Added this
(interaction as ModalSubmitInteraction).reply("ok")
(interaction as ModalSubmitInteraction).reply("ok")
Seems to not working
Unknown User
Unknown User3mo ago
Message Not Public
Sign In & Join Server To View
kps
kpsOP3mo ago
It's considered as a BaseInteraction even is the statement
kps
kpsOP3mo ago
No description
d.js docs
d.js docs3mo ago
:method: BaseInteraction#isModalSubmit() @14.15.3 Indicates whether this interaction is a ModalSubmitInteraction
Unknown User
Unknown User3mo ago
Message Not Public
Sign In & Join Server To View
kps
kpsOP3mo ago
Edited. Thanks. I got the same error I sent
Unknown User
Unknown User3mo ago
Message Not Public
Sign In & Join Server To View
kps
kpsOP3mo ago
if I log the interaction it's ok
No description
kps
kpsOP3mo ago
And there's not catching of errors after Only on UI discord I was handling my modals and as i have this error, i thought it was cuz of my handler but no. Even if i just handle it in interactionCreate, does not work Found the issue I won't say to you cuz i'm embarassed
Unknown User
Unknown User3mo ago
Message Not Public
Sign In & Join Server To View
kps
kpsOP3mo ago
I hope it's cuz i'm tired, customId was different
Unknown User
Unknown User3mo ago
Message Not Public
Sign In & Join Server To View
kps
kpsOP3mo ago
So, my handler was good tho i logged it many times and did not catch this mistake it's sad lol. Thanks anyway for your help !
Unknown User
Unknown User3mo ago
Message Not Public
Sign In & Join Server To View
Want results from more Discord servers?
Add your server