cant get the user option

i have a subcommand with a user option and a string option. Im trying to use autocomplete in the string option. And im trying to get the user option data inside autocomplete() function. but i cant get the user data by interaction.options.getUser(), it return null but when i log interaction.options it logs
CommandInteractionOptionResolver {
_group: null,
_subcommand: 'remove',
_hoistedOptions: [
{ value: '757912235908661299', type: 6, name: 'member' },
{ value: '', type: 3, name: 'warns', focused: true }
]
}
CommandInteractionOptionResolver {
_group: null,
_subcommand: 'remove',
_hoistedOptions: [
{ value: '757912235908661299', type: 6, name: 'member' },
{ value: '', type: 3, name: 'warns', focused: true }
]
}
i can't figure out how i can get { value: '757912235908661299', type: 6, name: 'member' }
9 Replies
d.js toolkit
d.js toolkit2y ago
• What's your exact discord.js npm list discord.js and node node -v version? • Post the full error stack trace, not just the top part! • Show your code! • Explain what exactly your issue is. • Not a discord.js issue? Check out #useful-servers.
Parogo_72
Parogo_722y ago
interaction.options.getUser(optionName) In your case "member"
DevBear
DevBearOP2y ago
that returns null inside autocomplete function
Parogo_72
Parogo_722y ago
And interaction.options.get("member").value?
DevBear
DevBearOP2y ago
wait that returned the id of that user
Parogo_72
Parogo_722y ago
Yeah, thats what you asked isnt it?
DevBear
DevBearOP2y ago
yeah thanks
Parogo_72
Parogo_722y ago
iirc you cant get the user from an autocomplete directly If you need it you can use client.users.fetch(id)
DevBear
DevBearOP2y ago
yeah ill do that i was confused why interaction.options.getUser() returned null anyways thanks
Want results from more Discord servers?
Add your server