Is it possible to populate the select options of a slash command from an api response? #1067
-
Part of the guide or code sample the question is about
QuestionIs it possible to populate the select options of a slash command, or any type of command, from an api response? eg a user enters a slash command with a string option, they are then presented with options fetched from an api. The idea is for the user to select a player from a game so they would enter the game ID eg XXX and then be presented with players from game XXX to choose from. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
If you can narrow it down to <= 25 to choose from you can respond to the initial slash command with a message including select components https://discordjs.guide/interactions/select-menus.html. If you can rapidly request new data without getting issues with rate limiting, you can also use the autocomplete approach mentioned in #1066 (the same caveats apply, of course) |
Beta Was this translation helpful? Give feedback.
-
it is not possible to fill in the parameters at the command input stage. The only way is to use an additional event or command that will populate them |
Beta Was this translation helpful? Give feedback.
If you can narrow it down to <= 25 to choose from you can respond to the initial slash command with a message including select components https://discordjs.guide/interactions/select-menus.html. If you can rapidly request new data without getting issues with rate limiting, you can also use the autocomplete approach mentioned in #1066 (the same caveats apply, of course)