[TS] Argument of type 'GuildMember | APIInteractionGuildMember | null'
full error
everything seems fine except line 11
npm v.9.6.7
node v.18.3.0
discord.js v14.11.0
5 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!<Interaction>.member
may not be a GuildMember
if the interaction was received in a dm or from a guild that isn't cached
you'd want to typeguard with <Interaction>.inCachedGuild()
if this is done prior to execute
being called, then you'd want to specify the generic <"cached">
for your interaction's type
as a side note, CommandInteraction
is for all application command interactions, including context menu commands
ChatInputCommandInteraction
is for slash commands
if you're typeguarding the interaction somewhere before execute
is called, you can use the <Interaction>.isChatInputCommand()
typeguardi used .isChatInputCommand() in my event handler
then that's perfectly ok
I just wanted to mention since you typed
inter
as CommandInteraction
oh
thx
also thx for the help
it worked