Discord Autocomplete

Is it possible to return an object from autocomplete? Discord.js version: v14.2.0 Node: v16.15.1
6 Replies
d.js docs
d.js docs3y 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.
monbrey
monbrey3y ago
I don't quite understand the question Return what to where?
⸸⛧Stealth⛧⸸
I want the autocomplete.respond() with a value being an object, like how it can respond with strings or numbers Like this
<AutocompleteInteraction>.respond([{ name: “Test”, value: {} }])
<AutocompleteInteraction>.respond([{ name: “Test”, value: {} }])
monbrey
monbrey3y ago
Nope, values are strings You can stringify an object though
⸸⛧Stealth⛧⸸
I tried that and I’m hitting the 100 character limit so I can’t do that, thank you for the answer
monbrey
monbrey3y ago
Then you should store your objects in a Map, and use the value to look them up
Want results from more Discord servers?
Add your server