interaction.options.getMember() not definable?
Somehow
interaction.options.getMember()
is not valid... While on the Discord.js docs it is.
I already made Member
to be outputted to a message, and it says @Jarvo, so it should be correct...
9 Replies
Solution
Oh. Nevermind. I fixed it already.
Nvm
Issue is not resolved.
Error:
And the Discord.js mods told me it's a sapphire problem 🙄
When I do
Member.
I get:
- addChannelOption
- addChannelTypes
- addComponents
- addFields
and more
Fixed*Well that's dumb because it's not
@vladdy pls educate your djs buddies
The problem here is that getMember can either be the DJS Class or an API object. That's just how discord.js's types work. The way to ensure that it's a GuildMember is by using type guards. In fact we export isGuildMember from @sapphire/discord.js-utilities (note the name... discord.js) for this very purpose
(Handle that error in a better way ofc)
![pepeHmm](https://cdn.discordapp.com/emojis/882665683257815130.png)
![pepeCry](https://cdn.discordapp.com/emojis/882665874891358258.png)
or cast your interaction as being cached if you know its always cached
@Favna it's already fixed. Seemed like VSC messed up...
We restarted VSC and it worked again.
Either way that casting as cached or using the type guards is still the way to go
we fetch the member
Yah then it's cached
yup