#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)
Hey! Once your issue is solved, press the button below to close this thread!
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)