When I run every other command it works perfectly fine, but when I use /rank it shows the “Unknown interaction” error, the error only occurs when the error handeling doesn’t have any problems, for example a valid user id and rank id, when it does though, it works perfectly fine.
I’m not a fan of try{} so if theres a away to fix it with using .try, let me know
Code:
if (interaction.commandName === "rank") {
const tuser = interaction.options.getNumber("targetuser");
const trank = interaction.options.getNumber("targetrank");
noblox
.changeRank(5156922, tuser, trank)
.then(async () => {
const username = await noblox.getUsernameFromId(tuser);
const grn = await noblox.getRankNameInGroup(5156922, tuser);
interaction.reply(
`The rank of ${username} has been updated and they have been ranked to **${grn}**`
);
})
.catch((error) => {
console.error(error.stack);
interaction.respond({
content: `Something went wrong, Here is what can have gone wrong: nn- **The user id does not exist or isn't in the group**n- **The rank number does not exist**nPlease double check the fields. Thank you!`,
ephemeral: true,
});
});
}
Error:
rawError: { message: 'Unknown interaction', code: 10062 },
code: 10062,
status: 404,
method: 'POST',
url: 'https://discord.com/api/v10/interactions/1193921932316377109/aW50ZXJhY3Rpb246MTE5MzkyMTkzMjMxNjM3NzEwOTpjRkVPQTZlSzUxNE1RQmxzM0M4Y3h1TFN6VU45ZmpkVEtXTXk2cThCalpGUWtiSXZHVnVtVVBxTzR2U01HcDZRb0RRT3RxeXAwYmZxTlpicDZIMjAwb3RreFQ4Wm5CaEN4MXVKdmx1cGZpZGRWdW5YUXo4Q2Zxd3NDZmNOM05WNQ/callback'
}
I’m trying to fix the /rank thing, please let me know.