I have created a choiceprovider following the example in documentation. It works fine.
public class choiceProvider : IChoiceProvider
{
public async Task<IEnumerable<DiscordApplicationCommandOptionChoice>> Provider()
{
DiscordApplicationCommandOptionChoice[] ret = new DiscordApplicationCommandOptionChoice[Program.events.Count];
for (var i = 0; i < Program.events.Count; i++)
{
ret[i] = new DiscordApplicationCommandOptionChoice(Program.events[i].id,Program.events[i].event_name);
}
return ret;
}
} ```
Here's an example header of using choice provider as an option to a slash command.
``` [SlashCommand("Test", "Test command")]
public async Task DisplayAvail(InteractionContext ctx, [ChoiceProvider(typeof(choiceProvider))][Option("event_id", "event id in question")] string option) ```
Problem is I want to dynamically change the choices offered based on **Program.events**, a static array in another class. But it seems that choice providers are cached when the commands are registered on bot startup.
Are there any possible workarounds?


