Interaction Handler (Buttons)

Hello there. I am trying to make a giveaway bot without using SQL / any database. I am quite new in coding hopefully can get more profession helps. Actually i have the giveaway bot done, but i didnt put the Interaction on button into my InteractionCreate. the issue is, whenever i create a new giveaway after bot start, it works. after that, i create 2nd giveaway, the interaction still work. but there is an error shows as there are some interaction Error. Which files do i need to upload here?
14 Replies
d.js toolkit
d.js toolkit2y ago
• 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.
FG
FGOP2y ago
d.js docs
d.js docs2y ago
Common causes of DiscordAPIError[10062]: Unknown interaction: • Initial response took more than 3 seconds ➞ defer the response *. • Wrong interaction object inside a collector. * Note: you cannot defer modal or autocomplete value responses
FG
FGOP2y ago
DiscordAPIError[10062]: Unknown interaction
at handleErrors (/home/devbot/node_modules/@discordjs/rest/dist/index.js:640:13)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async BurstHandler.runRequest (/home/devbot/node_modules/@discordjs/rest/dist/index.js:736:23)
at async REST.request (/home/devbot/node_modules/@discordjs/rest/dist/index.js:1387:22)
at async ButtonInteraction.reply (/home/devbot/node_modules/discord.js/src/structures/interfaces/InteractionResponses.js:111:5) {
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/1112393909365121105/aW50ZXJhY3Rpb246MTExMjM5MzkwOTM2NTEyMTEwNTpkUUp1RVJySE1VT01LUEpNZFYxemFHZDZxMmp1RmlyZDlsV012Rm9wMFRGbWFIMnBhSmRmOWw3QnB0eFJ5eXpuMDNxdkxmUmJvcEhOVmNrSDR5YUQ2VkhjUVZhOVlMRm1OTDhvUUxzRnhvSFV1TU03SDIzM3hweDFMbmxrQ1hjYg/callback'
DiscordAPIError[10062]: Unknown interaction
at handleErrors (/home/devbot/node_modules/@discordjs/rest/dist/index.js:640:13)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async BurstHandler.runRequest (/home/devbot/node_modules/@discordjs/rest/dist/index.js:736:23)
at async REST.request (/home/devbot/node_modules/@discordjs/rest/dist/index.js:1387:22)
at async ButtonInteraction.reply (/home/devbot/node_modules/discord.js/src/structures/interfaces/InteractionResponses.js:111:5) {
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/1112393909365121105/aW50ZXJhY3Rpb246MTExMjM5MzkwOTM2NTEyMTEwNTpkUUp1RVJySE1VT01LUEpNZFYxemFHZDZxMmp1RmlyZDlsV012Rm9wMFRGbWFIMnBhSmRmOWw3QnB0eFJ5eXpuMDNxdkxmUmJvcEhOVmNrSDR5YUQ2VkhjUVZhOVlMRm1OTDhvUUxzRnhvSFV1TU03SDIzM3hweDFMbmxrQ1hjYg/callback'
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
FG
FGOP2y ago
I didnt add any database, but i use a simple store: const enteredUsers = new Set(); // Set to store entered user IDs how can i defer the response...
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
FG
FGOP2y ago
pl ok
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
FG
FGOP2y ago
Hold on ya, let me show u my code in the button part
FG
FGOP2y ago
my interaction button is put inside my giveaway.js
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
FG
FGOP2y ago
then should be
if (interaction.customId === 'giveaway_join') {
interaction.reply
if (interaction.customId === 'giveaway_join') {
interaction.reply
to
if (interaction.customId === 'giveaway_join') {
interaction.deferReply().reply
if (interaction.customId === 'giveaway_join') {
interaction.deferReply().reply
?
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Want results from more Discord servers?
Add your server