SlashCommand interaction is undefined
Hey, I just encountered an Error I can't explain...
I get an error every time I execute an SlashCommand from my Bot telling me "interaction" is undefined.
I haven't changed anything in my App for a couple of weeks, so I can't tell when this error started to occur.
Things I've checked:
- if discord.js has a newer version that i can install
- already had the latest version 14.16.3
- I republished my SlashCommands to Discord
- still not working
This is an example breakdown of a command in my Application:
Here is the Stacktrace (I edited the path to make it more readable)
npm list:
[email protected]
node -v: v20.16.0
If you need more information just let me know ...11 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!
- ✅
Marked as resolved by staffUnknown User•2d ago
Message Not Public
Sign In & Join Server To View
Sure, I just found something there that could cause the issue, I'll check that first 👍
Unknown User•2d ago
Message Not Public
Sign In & Join Server To View
Okay, that was not the Issue ...
interactionCreate.ts
Unknown User•2d ago
Message Not Public
Sign In & Join Server To View
Ohh whoops you are right ... I'm wondering how this was working before 😅
Unknown User•2d ago
Message Not Public
Sign In & Join Server To View
We highly recommend you extend the
Client
structure properly instead of just attaching custom properties like .commands
to the regular discord.js Client
instance.
- Using typescript, you might want to consider casting or augmenting the module typeUnknown User•2d ago
Message Not Public
Sign In & Join Server To View
Yeah that was the issue 😄 the typing of the execute function was wrong thats why I haven't noticed the issue there
It's working now, thanks for your quick help! ❤️