APIInteractionGuildMember missing properties
It seems like
member
has to have to properties like nickname, but they're not accessible. I haven't beed using discord.js
in a while as well as @sapphire/framework
, were there changes that could cause that? If not, please, do enlighten me on the matter, thanks.Solution:Jump to solution
First of all, I set your nickname. Please do not set an unmentionable nickname/display name
As for your question,
interaction.member
is DJS code, see https://discord.js.org/docs/packages/discord.js/14.15.3/CommandInteraction:Class#member
If you hover over member
you will see that intellisense tells you it's a union of GuildMember|APIInteractionGuildMember
and you need to specify that the guild is cached, or cast the type. This has been a thing since....... idk djs v14? I cant quite recall but a long long time anyway...discord.js
discord.js
discord.js is a powerful Node.js module that allows you to interact with the Discord API very easily. It takes a much more object-oriented approach than most other JS Discord libraries, making your bot's code significantly tidier and easier to comprehend.
3 Replies
interaction
is of type Command.ChatInputCommandInteraction
btwSolution
First of all, I set your nickname. Please do not set an unmentionable nickname/display name
As for your question,
interaction.member
is DJS code, see https://discord.js.org/docs/packages/discord.js/14.15.3/CommandInteraction:Class#member
If you hover over member
you will see that intellisense tells you it's a union of GuildMember|APIInteractionGuildMember
and you need to specify that the guild is cached, or cast the type. This has been a thing since....... idk djs v14? I cant quite recall but a long long time anywaydiscord.js
discord.js
discord.js is a powerful Node.js module that allows you to interact with the Discord API very easily. It takes a much more object-oriented approach than most other JS Discord libraries, making your bot's code significantly tidier and easier to comprehend.
Yeah yeah yeah, thanks, I just forgot to typeguard the guild with
inCachedGuild()