I cannot figure out what I am doing wrong, please help
After I press the unclaim button, the embed should dissapear, a new one should appear and the channel should be renamed. But it makes it dissapear and nothing else. Please help.
My index.js: https://sourceb.in/gW6BG7VzcH
10 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 OPAre you getting any type of error when your code runs?
no
wait
i do
node:events:498
throw er; // Unhandled 'error' event
^
DiscordAPIError[10062]: Unknown interaction
at handleErrors (D:\alex dumb bot2\node_modules@discordjs\rest\dist\index.js:748:13)
at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
at async BurstHandler.runRequest (D:\alex dumb bot2\node_modules@discordjs\rest\dist\index.js:852:23)
at async _REST.request (D:\alex dumb bot2\node_modules@discordjs\rest\dist\index.js:1293:22)
at async ButtonInteraction.reply (D:\alex dumb bot2\node_modules\discord.js\src\structures\interfaces\InteractionResponses.js:194:22)
at async Client.<anonymous> (D:\alex dumb bot2\index.js:225:12)
Emitted 'error' event on Client instance at:
at emitUnhandledRejectionOrErr (node:events:403:10)
at process.processTicksAndRejections (node:internal/process/task_queues:92:21) {
requestBody: {
files: [],
json: {
type: 4,
data: {
content: 'Order unclaimed and now available for claim.',
tts: false,
nonce: undefined,
enforce_nonce: false,
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,
applied_tags: undefined,
poll: undefined
}
}
},
rawError: { message: 'Unknown interaction', code: 10062 },
code: 10062,
status: 404,
method: 'POST',
url: 'https://discord.com/api/v10/interactions/1382417808062939358/aW50ZXJhY3Rpb246MTM4MjQxNzgwODA2MjkzOTM1ODpqNWtsODhWazZGNUJwelJRN1BzaVA2c3JRM1paa1pTVGRiaFhXY2RxbEtvZkpGWUZOZnJmMHl4b3c5ellKSERBODZlTG40QjdKNGk4Z0p2bFBSZVlyTGlaU3doemRsV294bFZtbFVVcVlCSHB3d2w2d1JFVGZGdENkYzJmeTcwdg/callback?with_response=false'
}
so my guess is that you are replying to one of your interactions twice
could try doing a
followUp
instead
but also since you're deleting the claimed message (i.e. the button it would try to reply to) i think that would throw an erroryou're doing a lot of async actions before replying
it's taking more than 3s, which is an interaction token's lifetime
the error happens on line 225
return await interaction.reply({ content: 'Order unclaimed and now available for claim.', ephemeral: true });
you can't reply afterwards
so you'll need to defer before doing anything, and then editReply with your actual "order unclaimed" message
:this:
Thanks.