Bot works on windows, but not on ubuntu.
I am following the tutorial for slash commands and have copied exactly what is in the documentation. When running the /user command, it works on Windows, but Ubuntu returns an error:
23 Replies
- 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.
- Issue solved? Press the button!My code is here: https://github.com/Hazelwize/role-reactor
I am on Node version: 20.4.0
I have tested on Node version: 18.16.1 and 20.4.0
Discord.js version: 14.11.0
GitHub
GitHub - Hazelwize/role-reactor
Contribute to Hazelwize/role-reactor development by creating an account on GitHub.
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 responsesI get the same error when deferring the reply.
What’s the latency of the Ubuntu machine? The code you have is pretty bare bones it should be replying/deferring in enough time.
The error also suggests that you’re replying right in the interaction create file but that doesn’t match the repo.
How would I check the latency? I think you might be on to something, because I just got a response from the bot, but I have to send two slash commands back to back. The first request fails, but the second command gets a response.
Ok, weird workaround for my issue that I found. If I'm on a VPN then my bot works beautifully on Ubuntu. It works on Windows either way. I'm guessing this is 100% an issue with my setup in some way.
Probably just hitting the 3 second timeout timer, make sure you use deferReply as early as possible
if (interaction.commandName === 'ping') {
await interaction.deferReply(); // Defer the reply to ensure the command is acknowledged
const replyTimestamp = interaction.createdTimestamp;
const currentTimestamp = Date.now();
const latency = currentTimestamp - replyTimestamp;
await interaction.followUp(
Pong! Latency: ${latency}ms
);
}It's still throwing the Unknown Interaction error when using deferReply(). I put the code you posted inside of the execute function for interactionCreate.
Seems weird. Sounds like a network issue.
That's what I'm thinking. This is my 4th day on the issue. I'm ok just using a VPN at this point. haha
Please add the following code to your code base outside of any other event listeners and provide the full log output relevant to your issue.
- Note: if you initialize your Client as
bot
or other identifiers you need to use these instead of client
- If the output is too long to post consider using a bin instead: gist | paste.gg | sourceb.in | hastebinPost output of "date" and "curl HTTPS://discord.com" in the terminal
And this?
Without vpn
Was the two previous commands without vpn aswell?
Unless something is wrong with your registering code, which I don't think so because it works on your windows machine, I'd go with network since it works with VPN.
I can't remember if it was on or not. Here it is with it off for sure:
Is this with the vpn off?
Yes, this is with the vpn off
If you simply place
try {
interaction.deferReply();
} catch(err) {
Console.log(err)
}
At the start of execute function at interactionCreate.js what error do you get? @hazelwize
Try to console.log(interaction) at the start of the user.js execute, also add try...catch with console.log(err) in that file. If you are deferring the reply right at interactionCreate.js start, then it either takes over 3 seconds to even reach your host or there is a problem with routing the interaction from interactionCreate.js to the correct command.
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View