Issue with "custom" autocomplete
I will be sending the relevant parts of my code, I'm kind of new to this so please be patient,
I would like the command to load the user's options based on their inventory in mongoose, the autocomplete options don't load while the user tries to write in the item field, however the item is correctly used if the user writes the exact name (caps sensitive). I would like the autocomplete suggestions to be the user's available items, I have looked for the autocomplete in discord,js but I didn't quite understand how it should work for my case.
14 Replies
- What's your exact discord.js
npm list discord.js
and node node -v
version?
- Not a discord.js issue? Check out #other-js-ts.
- Consider reading #how-to-get-help to improve your question!
- Explain what exactly your issue is.
- Post the full error stack trace, not just the top part!
- Show your code!
- Issue solved? Press the button!
- ✅
Marked as resolved by OPv22.13.1, it won't show the discord.js when running the command you sent tho
Check if you are getting any errors in the console. Autocomplete needs to be responded within 3 sec, and since you are doing async operations (db call) it maybe taking longer. Another cause would be if you
suggestions
exceeds the 25 choices limits. In either case, an error would tell youThis is what I get, no error in the console though, also the total of items is about 6 so it shouldn't exceed the maximum number

tag suggestion for @Flotty:
If you aren't getting any errors, try to place
console.log
checkpoints throughout your code to find out where execution stops.
- Once you do, log relevant values and if-conditions
- More sophisticated debugging methods are breakpoints and runtime inspections: learn moreWait I'll send the full command (it's actually two different commands with the same issue but I assume if I fix one I should be able to fix the other)
Had to split it into 2 parts because I don't have nitro for longer messages lmao
Unknown User•3w ago
Message Not Public
Sign In & Join Server To View
:pikaOh:
I don't get what you mean
Unknown User•3w ago
Message Not Public
Sign In & Join Server To View
I had copied the command handler from a YouTube video, would I need to make a new file with the autocomplete handler or just add something in the old file?
Unknown User•3w ago
Message Not Public
Sign In & Join Server To View
Tyvm
:blobreachReverse:
Omg it worked ty @gwapes
Unknown User•3w ago
Message Not Public
Sign In & Join Server To View