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 toolkit15mo 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_7215mo ago
interaction.options.getUser(optionName) In your case "member"
DevBear
DevBear15mo ago
that returns null inside autocomplete function
Parogo_72
Parogo_7215mo ago
And interaction.options.get("member").value?
DevBear
DevBear15mo ago
wait that returned the id of that user
Parogo_72
Parogo_7215mo ago
Yeah, thats what you asked isnt it?
DevBear
DevBear15mo ago
yeah thanks
Parogo_72
Parogo_7215mo ago
iirc you cant get the user from an autocomplete directly If you need it you can use client.users.fetch(id)
DevBear
DevBear15mo ago
yeah ill do that i was confused why interaction.options.getUser() returned null anyways thanks