Error:
DiscordAPIError: Interaction has already been acknowledged.
at RequestHandler.execute (C:\Users\stask\Desktop\economy koshki.fun\node_modules\discord.js\src\rest\RequestHandler.js:350:13)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async RequestHandler.push (C:\Users\stask\Desktop\economy koshki.fun\node_modules\discord.js\src\rest\RequestHandler.js:51:14)
at async ButtonInteraction.reply (C:\Users\stask\Desktop\economy koshki.fun\node_modules\discord.js\src\structures\interfaces\InteractionResponses.js:99:5) {
method: 'post',
path: '/interactions/959709137103638559/aW50ZXJhY3Rpb246OTU5NzA5MTM3MTAzNjM4NTU5OnZ0T3B6cmpWR3BxWUtiRm1CMUFlQlhvTjFnbmVTVldsM3RVSWJvZkRhdzBNN0VRcXR1RDg4Smk3Q0E3M203RFpTaWdoUHRudFNzR1BQMkJHWUg1eFFucU9xWnBsTUVQSjN5SG4yd1dleFNMeE5Ndmo1cFBZcVNYdGRyV1RtTUNO/callback',
code: 40060,
httpStatus: 400,
requestData: {
json: {
type: 4,
data: {
content: 'Ready! You closed the channel!',
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
}
},
files: []
}
}
Code:
client.on('interactionCreate', async interaction => {
if (interaction.customId == 'lockv') {
if(interaction.member.roles.cache.has('892373628354711622')){
const channelLock = client.channels.cache.find(channel => channel.name == `Voice Chat ${interaction.member.user.username}`)
await channelLock.permissionOverwrites.edit(interaction.guild.id, { 'VIEW_CHANNEL': false, 'CONNECT': false, 'SPEAK': false });
interaction.reply({ content: 'Ready! You closed the channel!', ephemeral: true });
}
}
})
The purpose of my code: Close voice by button, in a separate channel (private voice system)
My code problem: I made a code to close the voice, but when the bot tries to tell the creator of the channel, the console gives an error and I don't know how to solve it.
Make sure to
awaityourinteraction.reply().Try the following fix: