#as a user is putting in parameters is it possible to know what option was selected prior to sending

1 messages · Page 1 of 1 (latest)

crystal abyss
#

I have a command that has 3 parameters; eg:
command -> alarm
parameters : day, hour, minute

its a very basic example but I want to know if its possible that what ever you put in day determines what choices are shown in hour..

Many thanks for le assistance

lean pondBOT
#

Hey! Once your issue is solved, press the button below to close this thread!

versed thunder
#

yes, you can call the first parameter as kwarg in the second parameter autocomplete:

@info.autocomplete('category')
async def info_autocomplete(ctx: AutocompleteContext):
    string_option_input = ctx.input_text.lower() 
    choices = general_list
    filtered_choices = [
        {"name": choice, "value": choice}
        for choice in choices
        if string_option_input in choice.lower() 
    ]
    filtered_choices = filtered_choices[:25]
    await ctx.send(choices=filtered_choices)   

@info.autocomplete('concept')
async def info_autocomplete(ctx: AutocompleteContext):
    string_option_input = ctx.input_text.lower()     
    category_name=ctx.kwargs.get('category')
    if category_name in general_list:
        filtered_choices = [
        {"name": choice, "value": choice}
        for choice in general_dictionary[category_name]
        if string_option_input in choice.lower() 
        ]
    filtered_choices = filtered_choices[:25]
    await ctx.send(choices=filtered_choices)