Modal submission help

I am trying to make a modal that asks for your minecraft username and then put it to the database. The modal opens successfully with my one field. But when I click submit it says interaction failed. I couldn't find something in the docs either. No errors in console. The code: https://pastebin.com/BiURBb6R
Pastebin
const { QuickDB } = require('quick.db');const db = new QuickDB();co...
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.
DT
d.js toolkit39d 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
M
monbrey39d ago
If it says it failed, you arent replying to the ModalSubmitInteraction
A
Acemavie39d ago
so this should fix it? if (!interaction.isModalSubmit()) return; if (interaction.customId === 'signup_modal') { await interaction.reply({ content: 'Your submission was received successfully!' }); }
M
monbrey39d ago
In theory yeah, if thats how/where you want to handle replying
A
Acemavie39d ago
That's werid casue it didn't still the same issue. I have absolutely no idea what I'm doing wrong
M
monbrey39d ago
Where are you actually handling the response from the modal? You must want to capture what they wrote
A
Acemavie39d ago
No description
M
monbrey39d ago
Yeah just reply there You cant editReply that interaction, since you havent replied to it yet
DD
d.js docs39d ago
:method: ModalSubmitInteraction#update() Updates the original message of the component on which the interaction was received on.
M
monbrey39d ago
This will probably do what you wanted
A
Acemavie39d ago
What am I doing wrong here?
No description
M
monbrey39d ago
I dont know, what error are you getting Same one?
A
Acemavie39d ago
No error just this
No description
A
Acemavie39d ago
I mean no error in console
A
Acemavie39d ago
This is the entire file if that helps https://pastebin.com/0zY60dYQ
Pastebin
const { QuickDB } = require('quick.db');const db = new QuickDB();co...
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.
M
monbrey39d ago
Is the collector even firing? Oh, you're using a message component collector Modals are not message components Thats why its not collecting it
A
Acemavie39d ago
How would I do it then?
M
monbrey39d ago
You can use a regular InteractionCollector, or awaitModalSubmit
A
Acemavie39d ago
why am I getting this error? await ModalSubmitInteraction.reply("test") ^ TypeError: ModalSubmitInteraction.reply is not a function at handleSignup (R:\Developer\Discord bots\Foxia\Foxia Events\src\utils\signup.js:33:34) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async InteractionCollector.<anonymous> (R:\Developer\Discord bots\Foxia\Foxia Events\src\Commands\Event\eventCreate.js:73:29) Node.js v18.17.1 I added this await ModalSubmitInteraction.reply("test")
M
monbrey39d ago
Uhh because whatever that is, is not a ModalSubmitInteraction
A
Acemavie39d ago
I did something interaction.awaitModalSubmit({ time: 60000, filter: (interaction) => interaction.isModalSubmit() && interaction.customId === 'signup_modal', }) .then(interaction => interaction.editReply('Thank you for your submission!')) .catch(err => console.log('No modal submit interaction was collected')); It says in the console no modal submit interaction was collected. and still the same error in the modal. What is missing here?
A
Acemavie39d ago
Wait does this need to be a client.on?
No description
M
monbrey39d ago
What does this have to do with the rest of your code Im so confused
A
Acemavie39d ago
I am trying to get the user provided info from the modal and a reply to the user so the error disappears. But nothing works
M
monbrey39d ago
You keep changing other parts of your code that aren't what I'm advising. Can you show your collector code currently?
A
Acemavie39d ago
Tried removing the collector code
No description
M
monbrey39d ago
This isnt a collector Why did you remove it Or where is interaction coming from here
A
Acemavie39d ago
I have no idea at this point I am getting very very confused
M
monbrey39d ago
The pastebin you provided earlier was close to correct, except you used the wrong type of collector If you changed line 35 from creating a message component collector to const submit = await interaction.awaitModalSubmit({ filter, time }) etc, it would probably be fine Then submit.options.getTextInputValue etc
A
Acemavie39d ago
This error now: submit.on('collect', async (interaction) => { ^ TypeError: submit.on is not a function at handleSignup (R:\Developer\Discord bots\Foxia\Foxia Events\src\utils\signup.js:37:11) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async InteractionCollector.<anonymous> (R:\Developer\Discord bots\Foxia\Foxia Events\src\Commands\Event\eventCreate.js:73:29) Node.js v18.17.1
M
monbrey39d ago
Never told you to do that
DD
d.js docs39d ago
:guide: Popular Topics: Collectors - Interaction collectors > Await modal submit If you want to wait for the submission of a modal within the context of another command or button execution, you may find the promisified collector CommandInteraction#awaitModalSubmit()open in new window useful. read more
A
Acemavie39d ago
Then collector.on is a undefined variable
No description
M
monbrey39d ago
Yeah because it isnt, this isnt a collector, it awaits one modal submission submit is the interaction You also need to put your actual filter and time variable options in there, not copy paste what I did exactly
A
Acemavie39d ago
So I'd remove this?
No description
M
monbrey39d ago
And fix your filter/time options yeah
A
Acemavie39d ago
and replace interaction.reply with submit.reply?
M
monbrey39d ago
yeah
A
Acemavie39d ago
Now this error: R:\Developer\Discord bots\Foxia\Foxia Events\src\utils\signup.js:38 const minecraftUsername = await submit.getTextInputValue('minecraftusername'); ^ TypeError: submit.getTextInputValue is not a function at handleSignup (R:\Developer\Discord bots\Foxia\Foxia Events\src\utils\signup.js:38:48) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async InteractionCollector.<anonymous> (R:\Developer\Discord bots\Foxia\Foxia Events\src\Commands\Event\eventCreate.js:73:29) Node.js v18.17.1
M
monbrey39d ago
options.get sorry, fields.get
A
Acemavie39d ago
finnaly it works just some weird db error left Thanks alot!
Want results from more Discord servers?
Add your server
More Posts
can someon help me with a bot discord (discord.js node)I created a discord bot in node, and for the ",ping" command it sends the same message 3 times... caI'm trying to make my Discord Bot Reply when a user sends an Image in ChatI have a working discord bot that responds to people and I'm even getting it to tell me the weather Can you use variable in embedBuilder name and description?I have a embedBuilder instance and It doesn't seem to work. const embed = new EmbedBuilder() Bot stopped workingmy bot suddenly stopped working, it says 'application did not respond' when i try to run any commandHow to get the user id, username, nick when mentioned by another userI tried `m.mentions.members.first()` but to no avail it didn't work as expected due to the `mentionsShifts logsHello, I've been thinking of adding a command to my bot that logs people's shifts. The concept is tDiscordAPIError[10008]: Unknown Message} /root/bots/Synth/node_modules/@discordjs/rest/dist/index.js:640 throw new DiscordAPIError(daim still new to all this and cant install node.js to discord and need some help if possibleim sorry for asking this but all videos are so confusing and dont show all the stepsmember.setNickname or member.roles.add occasionally not workingHi all, What reasons are there for a nickname potentially not being applied, or a role potentially I have an error in my botHello, sorry for the inconvenience, but I have a problem with my bot, since it turns off due to an eButton QuestionHow can i make a button never expire?Commands not refreshing after being correctly deployedGood evening. I'm developing a discord.js bot using typescript. I am having trouble using my deployeguild.guildScheduledEventUserAdd event failing to fire consistentlyI am having an issue with the guildScheduledEventUserAdd event. It seems to trigger sometimes but whWhere do I start from?Hi, Can y'all share some helpful resouces with me so that I can understand and learn about npmjs?? THelp me plsCode: Error: `[WARNING] The command at C:\Users\OE104655\Videos\Eendsmp bot\commands\utility\giveawHelp me plsIdk whats wrong with this line of code: `const client = new Client({ intents: [GatewayIntentBits.Guiis it possible to run command 1 from command 2so like command 1 is /embed title: description: And i want to run that command with pre-set values fHow do I add a role with discord.js```js const target = interaction.options.getUser('target'); const role = interaction.options.getRolecheck if role is set to certain role idshow do i check if the role is set to certain ids? ```js const role = interaction.optHow do you turn on a discord bot?It ain't on