Random "DiscordAPIError[10062]: Unknown Interaction"
i try reproduce the error, but it is so random, I just run the '/user' command several times then it will eventually hit this error. I think it is at 'interaction.deferReply(something)'.
const { SlashCommandBuilder } = require('discord.js');
module.exports = {
cooldown: 5,
data: new SlashCommandBuilder()
.setName('user')
.setDescription('Provides information about the member.')
.addUserOption(option => option.setName('target')
.setDescription('The member to display information for')
.setRequired(true)),
async execute(interaction) {
console.log('user.js');
await interaction.deferReply({ ephemeral: true });
console.log('user check 1');
const user = await interaction.options.getUser('target', true);
console.log(`This user ${user?.username}, who joined on ${user?.createdAt}.`);
if (!user) {
await interaction.editReply('User not found');
} else {
await interaction.editReply(`This user ${user?.username}, who joined on ${user?.createdAt}.`);
}
},
};const { SlashCommandBuilder } = require('discord.js');
module.exports = {
cooldown: 5,
data: new SlashCommandBuilder()
.setName('user')
.setDescription('Provides information about the member.')
.addUserOption(option => option.setName('target')
.setDescription('The member to display information for')
.setRequired(true)),
async execute(interaction) {
console.log('user.js');
await interaction.deferReply({ ephemeral: true });
console.log('user check 1');
const user = await interaction.options.getUser('target', true);
console.log(`This user ${user?.username}, who joined on ${user?.createdAt}.`);
if (!user) {
await interaction.editReply('User not found');
} else {
await interaction.editReply(`This user ${user?.username}, who joined on ${user?.createdAt}.`);
}
},
};
