Embed User Input
I am looking to accept a user input to fill in a few values in my embed command. How would I go about doing that? I attached a photo of the design that I am trying to access to help clarify if needed!
7 Replies
- 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 OPThank you! I was able to get variables in place to handle input, but now I have a seperate issue related to it. When I send the Embed I am receiving an error and it is stopping my bot and I have to restart, any idea how to prevent this from happening? The command works perfectly, I just need it to not quit the app when I run the embed:
DiscordAPIError[10062]: Unknown interaction
at handleErrors (c:\Coding Projects\Javascript\DAD_BOT\node_modules@discordjs\rest\dist\index.js:722:13)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async BurstHandler.runRequest (c:\Coding Projects\Javascript\DAD_BOT\node_modules@discordjs\rest\dist\index.js:826:23)
at async _REST.request (c:\Coding Projects\Javascript\DAD_BOT\node_modules@discordjs\rest\dist\index.js:1266:22)
at async ChatInputCommandInteraction.reply (c:\Coding Projects\Javascript\DAD_BOT\node_modules\discord.js\src\structures\interfaces\InteractionResponses.js:111:5)
at async Object.execute (c:\Coding Projects\Javascript\DAD_BOT\commands\utility\mapwipe.js:32:9)
at async Object.execute (c:\Coding Projects\Javascript\DAD_BOT\events\interactionCreate.js:16:4) {
requestBody: { files: [], json: { type: 4, data: [Object] } },
rawError: { message: 'Unknown interaction', code: 10062 },
code: 10062,
status: 404,
method: 'POST',
url: 'https://discord.com/api/v10/interactions/1219845625416388609/aW50ZXJhY3Rpb246MTIxOTg0NTYyNTQxNjM4ODYwOTpzUFd4VXoxVFFpNm9Yd1NZdlpHdERId1ppdDl2cmpOTWNCa05jS2tnTXVoVHpVdmlUWkE1UWFzcjBXdWFIVklaeTVlQXltTG5vSTAyamdsazBMazN3TjhLMGxMR0ZYTlRPMnlkZHdYY3M1VUFXc0lPSnZIU3lSSURwc1llQk8wRw/callback'
}
node:events:496
throw er; // Unhandled 'error' event
^
DiscordAPIError[40060]: Interaction has already been acknowledged.
at handleErrors (c:\Coding Projects\Javascript\DAD_BOT\node_modules@discordjs\rest\dist\index.js:722:13)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async BurstHandler.runRequest (c:\Coding Projects\Javascript\DAD_BOT\node_modules@discordjs\rest\dist\index.js:826:23)
at async _REST.request (c:\Coding Projects\Javascript\DAD_BOT\node_modules@discordjs\rest\dist\index.js:1266:22)
at async ChatInputCommandInteraction.reply (c:\Coding Projects\Javascript\DAD_BOT\node_modules\discord.js\src\structures\interfaces\InteractionResponses.js:111:5) at async Object.execute (c:\Coding Projects\Javascript\DAD_BOT\events\interactionCreate.js:22:5) Emitted 'error' event on Client instance at: at emitUnhandledRejectionOrErr (node:events:401:10) at process.processTicksAndRejections (node:internal/process/task_queues:84:21) { requestBody: { files: [], json: { type: 4, data: { content: 'There was an error while executing this command!', tts: false, nonce: undefined, embeds: undefined, components: undefined, username: undefined, avatar_url: undefined, allowed_mentions: undefined, flags: 64, message_reference: undefined, attachments: undefined, sticker_ids: undefined, thread_name: undefined } } }, rawError: { message: 'Interaction has already been acknowledged.', code: 40060 }, code: 40060, status: 400, method: 'POST', url: 'https://discord.com/api/v10/interactions/1219845625416388609/aW50ZXJhY3Rpb246MTIxOTg0NTYyNTQxNjM4ODYwOTpzUFd4VXoxVFFpNm9Yd1NZdlpHdERId1ppdDl2cmpOTWNCa05jS2tnTXVoVHpVdmlUWkE1UWFzcjBXdWFIVklaeTVlQXltTG5vSTAyamdsazBMazN3TjhLMGxMR0ZYTlRPMnlkZHdYY3M1VUFXc0lPSnZIU3lSSURwc1llQk8wRw/callback' }
at async ChatInputCommandInteraction.reply (c:\Coding Projects\Javascript\DAD_BOT\node_modules\discord.js\src\structures\interfaces\InteractionResponses.js:111:5) at async Object.execute (c:\Coding Projects\Javascript\DAD_BOT\events\interactionCreate.js:22:5) Emitted 'error' event on Client instance at: at emitUnhandledRejectionOrErr (node:events:401:10) at process.processTicksAndRejections (node:internal/process/task_queues:84:21) { requestBody: { files: [], json: { type: 4, data: { content: 'There was an error while executing this command!', tts: false, nonce: undefined, embeds: undefined, components: undefined, username: undefined, avatar_url: undefined, allowed_mentions: undefined, flags: 64, message_reference: undefined, attachments: undefined, sticker_ids: undefined, thread_name: undefined } } }, rawError: { message: 'Interaction has already been acknowledged.', code: 40060 }, code: 40060, status: 400, method: 'POST', url: 'https://discord.com/api/v10/interactions/1219845625416388609/aW50ZXJhY3Rpb246MTIxOTg0NTYyNTQxNjM4ODYwOTpzUFd4VXoxVFFpNm9Yd1NZdlpHdERId1ppdDl2cmpOTWNCa05jS2tnTXVoVHpVdmlUWkE1UWFzcjBXdWFIVklaeTVlQXltTG5vSTAyamdsazBMazN3TjhLMGxMR0ZYTlRPMnlkZHdYY3M1VUFXc0lPSnZIU3lSSURwc1llQk8wRw/callback' }
the first error means you are taking too long to reply to the interaction
the second one means you are trying to send an initial reply (.reply() or .deferReply()) to an already replied interaction
you can prevent your bot from crashing using try catch to catch these promise rejections, although your should handle these errors gracefully. For the first one, you have to send a reply within the first 3 seconds of receiving it, so if you are calling some kind of database before replying to the interaction, then use
interaction.deferReply()
Common causes of
DiscordAPIError[10062]: Unknown interaction
:
- Initial response took more than 3 seconds ➞ defer the response *.
- Wrong interaction object inside a collector.
- Two processes handling the same command (the first consumes the interaction, so it won't be valid for the other instance)
* Note: you cannot defer modal or autocomplete value responsesfor the second error, you have to avoid replying to the same interaction twice
-
DiscordAPIError: Interaction has already been acknowledged
- [InteractionAlreadyReplied]: The reply to this interaction has already been sent or deferred.
You have already replied to the interaction.
- Use <Interaction>.followUp()
to send a new message
- If you deferred reply it's better to use <Interaction>.editReply()
- Responding to slash commands / message components