Loading slash choices from file

Hello, I want to create a bot that can load a big number of slash command choices from a JSON or CSV file, add them into a collection and automatically add them to a slash command on run. How can I achieve something like that? So far I've only seeing people hard-coding choices in their bots, so if this is possible then I'd like to know how.
6 Replies
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Araraura
ArarauraOP2y ago
discord.js 14.7.1 and node 19.6.0
d.js docs
d.js docs2y ago
guide Slash Commands: Autocomplete read more
Araraura
ArarauraOP2y ago
I'll check this out, thanks Do you know how can I truncate my list of choices to display based on what text the user has entered into the command so far? so it would actually be autocomplete oh true, sorry do you know how to prevent the app from crashing when no text was entered yet? because then it just crashes since it pulls the whole list and crashes since it's over 25
d.js docs
d.js docs2y ago
mdn Array.prototype.slice() The slice() method returns a shallow copy of a portion of an array into a new array object selected from start to end (end not included) where start and end represent the index of items in that array. The original array will not be modified.
Araraura
ArarauraOP2y ago
ohhh, thank you sorry for needing help with such basic stuff, i've been rusty
Want results from more Discord servers?
Add your server