Discordjs Slash Command - Option with Dynamic time #6881
-
Hi all, I have a slash command that asks users to select a date and time. I was hoping to make the date and time dynamic, so that the first Date option would always be the current day, and the first Time option would be the current Hour as these are usually the most likely options. This works great when the bot starts, however I quickly learned the values seem to be assigned when the command is deployed, not when a user initiates the command, so the date and time values are not updating as time progresses. It is possible to restart the bot which forces the values to update, however is there any method available within discordjs to have command values evaluated at runtime? Snippet from the command below, which essentially displays options like: Thanks all.
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
FWIW, as a workaround I've created a cron job to update the commands every hour |
Beta Was this translation helpful? Give feedback.
-
Dynamically populating choices at the time the user uses the command will be possible with the autocomplete feature #6672. This will be available in the library with the next minor version 13.3 after Discord confirmed the API to be stable by merging the relevant API doc pull request. |
Beta Was this translation helpful? Give feedback.
Dynamically populating choices at the time the user uses the command will be possible with the autocomplete feature #6672. This will be available in the library with the next minor version 13.3 after Discord confirmed the API to be stable by merging the relevant API doc pull request.