Property 'getMessage' does not exist
Hello, I've just updated to the latest version of discord.js and I can't seem to access the getMessage option in interaction.options.
is there a type checking needed that I'm not aware of?
I get this error with the code above:
package.json
"typescript": "^5.4.2"
"discord.js": "^14.15.2"
Thanks in adv!
4 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 OPI believe this behavior would have been emitted in previous semver-minor versions as well, so I find it odd you're only getting this TS error after updating. In any case, You'd want to type your
interaction
parameter as a MessageContextMenuCommandInteraction, which is a more narrowed ContextMenuCommandInteraction with additional types including getMessage()
which is specific to message context menu commands:class: MessageContextMenuCommandInteraction
@14.15.2
Represents a message context menu interaction.Ahhh, I did not notice this type existed. Thank you very much