DiscordAPIError[10062]: Unknown interaction
Slash-Commands registriert
Editing existing embed...
Fehler beim Ausführen des Befehls: DiscordAPIError[10062]: Unknown interaction
at handleErrors (C:\Users\flo\Desktop\RevolutionV_New\Bot\RV_bot\node_modules\@discordjs\rest\dist\index.js:730:13)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async BurstHandler.runRequest (C:\Users\flo\Desktop\RevolutionV_New\Bot\RV_bot\node_modules\@discordjs\rest\dist\index.js:835:23)
at async _REST.request (C:\Users\flo\Desktop\RevolutionV_New\Bot\RV_bot\node_modules\@discordjs\rest\dist\index.js:1278:22)
at async ChatInputCommandInteraction.deferReply (C:\Users\flo\Desktop\RevolutionV_New\Bot\RV_bot\node_modules\discord.js\src\structures\interfaces\InteractionResponses.js:71:5)
at async Client.<anonymous> (C:\Users\flo\Desktop\RevolutionV_New\Bot\RV_bot\index.js:90:7) {
requestBody: { files: undefined, json: { type: 5, data: [Object] } },
rawError: { message: 'Unknown interaction', code: 10062 },
code: 10062,
status: 404,
method: 'POST',
url: 'https://discord.com/api/v10/interactions/1266191165921820723/aW50ZXJhY3Rpb246MTI2NjE5MTE2NTkyMTgyMDcyMzpUbU1GSFNmN0R4RG9NclFHWFlWZmJGTlRacVVncXZPUlc1cWRPQXh2WlZzN0U2bFdXYXd3c1dVVW9HY21FZlNlVFBLQmdTTDR2emI0SFRpenBDa1dWTmV5MklCczFFSVlleGo4dUNOb2RJVmhoeXFrdmRndXRNZDA4QkZsWTVydg/callback'
}
node:events:497
throw er; // Unhandled 'error' event
^
Error [InteractionAlreadyReplied]: The reply to this interaction has already been sent or deferred.
at ChatInputCommandInteraction.reply (C:\Users\flo\Desktop\RevolutionV_New\Bot\RV_bot\node_modules\discord.js\src\structures\interfaces\InteractionResponses.js:104:46)
at Client.<anonymous> (C:\Users\flo\Desktop\RevolutionV_New\Bot\RV_bot\index.js:102:25)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
Emitted 'error' event on Client instance at:
at emitUnhandledRejectionOrErr (node:events:402:10)
at process.processTicksAndRejections (node:internal/process/task_queues:84:21) {
code: 'InteractionAlreadyReplied'
}
Node.js v21.7.1
PS C:\Users\flo\Desktop\RevolutionV_New\Bot\RV_bot>
Slash-Commands registriert
Editing existing embed...
Fehler beim Ausführen des Befehls: DiscordAPIError[10062]: Unknown interaction
at handleErrors (C:\Users\flo\Desktop\RevolutionV_New\Bot\RV_bot\node_modules\@discordjs\rest\dist\index.js:730:13)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async BurstHandler.runRequest (C:\Users\flo\Desktop\RevolutionV_New\Bot\RV_bot\node_modules\@discordjs\rest\dist\index.js:835:23)
at async _REST.request (C:\Users\flo\Desktop\RevolutionV_New\Bot\RV_bot\node_modules\@discordjs\rest\dist\index.js:1278:22)
at async ChatInputCommandInteraction.deferReply (C:\Users\flo\Desktop\RevolutionV_New\Bot\RV_bot\node_modules\discord.js\src\structures\interfaces\InteractionResponses.js:71:5)
at async Client.<anonymous> (C:\Users\flo\Desktop\RevolutionV_New\Bot\RV_bot\index.js:90:7) {
requestBody: { files: undefined, json: { type: 5, data: [Object] } },
rawError: { message: 'Unknown interaction', code: 10062 },
code: 10062,
status: 404,
method: 'POST',
url: 'https://discord.com/api/v10/interactions/1266191165921820723/aW50ZXJhY3Rpb246MTI2NjE5MTE2NTkyMTgyMDcyMzpUbU1GSFNmN0R4RG9NclFHWFlWZmJGTlRacVVncXZPUlc1cWRPQXh2WlZzN0U2bFdXYXd3c1dVVW9HY21FZlNlVFBLQmdTTDR2emI0SFRpenBDa1dWTmV5MklCczFFSVlleGo4dUNOb2RJVmhoeXFrdmRndXRNZDA4QkZsWTVydg/callback'
}
node:events:497
throw er; // Unhandled 'error' event
^
Error [InteractionAlreadyReplied]: The reply to this interaction has already been sent or deferred.
at ChatInputCommandInteraction.reply (C:\Users\flo\Desktop\RevolutionV_New\Bot\RV_bot\node_modules\discord.js\src\structures\interfaces\InteractionResponses.js:104:46)
at Client.<anonymous> (C:\Users\flo\Desktop\RevolutionV_New\Bot\RV_bot\index.js:102:25)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
Emitted 'error' event on Client instance at:
at emitUnhandledRejectionOrErr (node:events:402:10)
at process.processTicksAndRejections (node:internal/process/task_queues:84:21) {
code: 'InteractionAlreadyReplied'
}
Node.js v21.7.1
PS C:\Users\flo\Desktop\RevolutionV_New\Bot\RV_bot>
6 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!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 responses
- 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@sïř.jõ
module.exports = async (client, interaction) => {
if (!interaction.isCommand()) {
logError(client, new Error('Unknown interaction type'));
return;
}
const command = client.commands.get(interaction.commandName);
if (!command) {
try {
await interaction.reply({ content: 'Dieser Befehl existiert nicht.', ephemeral: true });
} catch (error) {
logError(client, error);
}
return;
}
if (!interaction.member.roles.cache.has(client.config.verwaltungRole)) {
try {
await interaction.reply({ content: 'Du hast nicht die erforderliche Rolle, um diesen Befehl auszuführen.', ephemeral: true });
} catch (error) {
logError(client, error);
}
return;
}
try {
// Verzögerte Antwort, um zu verhindern, dass die Interaktion abläuft
if (!interaction.deferred && !interaction.replied) {
await interaction.deferReply({ ephemeral: true });
}
await command.execute(client, interaction);
// logCommandUsage(client, interaction.commandName, interaction.user);
if (!interaction.replied) {
await interaction.editReply({ content: 'Die Partnerschaftsnachricht wurde erfolgreich gesendet!' });
}
} catch (error) {
console.error('Fehler beim Ausführen des Befehls:', error);
if (interaction.deferred && !interaction.replied) {
try {
await interaction.editReply({ content: 'Etwas ist schiefgelaufen!', ephemeral: true });
} catch (editReplyError) {
console.error('Fehler beim Editieren der Antwort:', editReplyError);
logError(client, editReplyError);
}
} else if (!interaction.replied) {
try {
await interaction.reply({ content: 'Etwas ist schiefgelaufen!', ephemeral: true });
} catch (replyError) {
console.error('Fehler beim Antworten auf Interaktion:', replyError);
logError(client, replyError);
}
}
logError(client, error);
}
};
module.exports = async (client, interaction) => {
if (!interaction.isCommand()) {
logError(client, new Error('Unknown interaction type'));
return;
}
const command = client.commands.get(interaction.commandName);
if (!command) {
try {
await interaction.reply({ content: 'Dieser Befehl existiert nicht.', ephemeral: true });
} catch (error) {
logError(client, error);
}
return;
}
if (!interaction.member.roles.cache.has(client.config.verwaltungRole)) {
try {
await interaction.reply({ content: 'Du hast nicht die erforderliche Rolle, um diesen Befehl auszuführen.', ephemeral: true });
} catch (error) {
logError(client, error);
}
return;
}
try {
// Verzögerte Antwort, um zu verhindern, dass die Interaktion abläuft
if (!interaction.deferred && !interaction.replied) {
await interaction.deferReply({ ephemeral: true });
}
await command.execute(client, interaction);
// logCommandUsage(client, interaction.commandName, interaction.user);
if (!interaction.replied) {
await interaction.editReply({ content: 'Die Partnerschaftsnachricht wurde erfolgreich gesendet!' });
}
} catch (error) {
console.error('Fehler beim Ausführen des Befehls:', error);
if (interaction.deferred && !interaction.replied) {
try {
await interaction.editReply({ content: 'Etwas ist schiefgelaufen!', ephemeral: true });
} catch (editReplyError) {
console.error('Fehler beim Editieren der Antwort:', editReplyError);
logError(client, editReplyError);
}
} else if (!interaction.replied) {
try {
await interaction.reply({ content: 'Etwas ist schiefgelaufen!', ephemeral: true });
} catch (replyError) {
console.error('Fehler beim Antworten auf Interaktion:', replyError);
logError(client, replyError);
}
}
logError(client, error);
}
};
const { SlashCommandBuilder } = require('@discordjs/builders');
const { EmbedBuilder } = require('discord.js');
module.exports = {
data: new SlashCommandBuilder()
.setName('serverinfo')
.setDescription('Zeigt Informationen über den Server an.'),
async execute(interaction) {
const { guild } = interaction;
try {
const serverName = guild.name;
const memberCount = guild.memberCount;
const serverId = guild.id;
const serverAvatar = guild.iconURL();
const serverBanner = guild.bannerURL() || 'Kein Banner';
const serverBoosts = guild.premiumSubscriptionCount;
const serverCreationDate = guild.createdAt.toDateString();
const serverOwner = await guild.fetchOwner();
const embed = new EmbedBuilder()
.setColor(0x0099FF)
.setTitle('RevolutionV')
.setDescription('Server Information')
.addFields(
{ name: 'Server Name', value: serverName, inline: true },
{ name: 'Server Mitglieder', value: memberCount.toString(), inline: true },
{ name: 'Server ID', value: serverId, inline: true },
{ name: 'Server Avatar', value: serverAvatar ? `[Link](${serverAvatar})` : 'Kein Avatar', inline: true },
{ name: 'Server Banner', value: serverBanner, inline: true },
{ name: 'Server Boosts', value: serverBoosts.toString(), inline: true },
{ name: 'Server Erstallt am', value: serverCreationDate, inline: true },
{ name: 'Server Eigentümer', value: serverOwner.user.tag, inline: true }
)
.setTimestamp()
.setFooter({ text: 'RevolutionV RolePlay | Hosted by PrepaidServerHost' });
if (!interaction.replied && !interaction.deferred) {
await interaction.reply({ embeds: [embed] });
} else if (interaction.deferred) {
await interaction.editReply({ embeds: [embed] });
}
} catch (error) {
console.error('Fehler beim Ausführen des serverinfo-Befehls:', error);
if (!interaction.replied && !interaction.deferred) {
await interaction.reply({ content: 'Beim Ausführen des Befehls ist ein Fehler aufgetreten.', ephemeral: true });
} else if (interaction.deferred) {
try {
await interaction.editReply({ content: 'Beim Ausführen des Befehls ist ein Fehler aufgetreten.', ephemeral: true });
} catch (followUpError) {
console.error('Fehler beim Follow-Up der Interaktion:', followUpError);
}
}
}
},
};
const { SlashCommandBuilder } = require('@discordjs/builders');
const { EmbedBuilder } = require('discord.js');
module.exports = {
data: new SlashCommandBuilder()
.setName('serverinfo')
.setDescription('Zeigt Informationen über den Server an.'),
async execute(interaction) {
const { guild } = interaction;
try {
const serverName = guild.name;
const memberCount = guild.memberCount;
const serverId = guild.id;
const serverAvatar = guild.iconURL();
const serverBanner = guild.bannerURL() || 'Kein Banner';
const serverBoosts = guild.premiumSubscriptionCount;
const serverCreationDate = guild.createdAt.toDateString();
const serverOwner = await guild.fetchOwner();
const embed = new EmbedBuilder()
.setColor(0x0099FF)
.setTitle('RevolutionV')
.setDescription('Server Information')
.addFields(
{ name: 'Server Name', value: serverName, inline: true },
{ name: 'Server Mitglieder', value: memberCount.toString(), inline: true },
{ name: 'Server ID', value: serverId, inline: true },
{ name: 'Server Avatar', value: serverAvatar ? `[Link](${serverAvatar})` : 'Kein Avatar', inline: true },
{ name: 'Server Banner', value: serverBanner, inline: true },
{ name: 'Server Boosts', value: serverBoosts.toString(), inline: true },
{ name: 'Server Erstallt am', value: serverCreationDate, inline: true },
{ name: 'Server Eigentümer', value: serverOwner.user.tag, inline: true }
)
.setTimestamp()
.setFooter({ text: 'RevolutionV RolePlay | Hosted by PrepaidServerHost' });
if (!interaction.replied && !interaction.deferred) {
await interaction.reply({ embeds: [embed] });
} else if (interaction.deferred) {
await interaction.editReply({ embeds: [embed] });
}
} catch (error) {
console.error('Fehler beim Ausführen des serverinfo-Befehls:', error);
if (!interaction.replied && !interaction.deferred) {
await interaction.reply({ content: 'Beim Ausführen des Befehls ist ein Fehler aufgetreten.', ephemeral: true });
} else if (interaction.deferred) {
try {
await interaction.editReply({ content: 'Beim Ausführen des Befehls ist ein Fehler aufgetreten.', ephemeral: true });
} catch (followUpError) {
console.error('Fehler beim Follow-Up der Interaktion:', followUpError);
}
}
}
},
};
Unknown User•5mo ago
Message Not Public
Sign In & Join Server To View
Okay So I have to swap All await interaction.reply for <Interaction>.followUp() right?
Or all reply with editReply and put a deferReply after the start of the command