#Using the same autocomplete function for multiple commands

1 messages · Page 1 of 1 (latest)

violet thorn
#

Is this possible ?

violet thorn
# nocturne bobcat yes there is a global autocomplete iirc

ok, i've coded it up and it doesn"t show ```@global_autocomplete(option_name="icao")
async def autocomplete( ctx: AutocompleteContext):
# make sure this is done within three seconds

choices = []
for x,icao in enumerate(await list_apt()):
    if ctx.input_text == "":
        if len(choices) < 25:
            
            choices.append({
                    "name": f"{icao}",
                    "value": f"{icao}",
                })
    if icao.startswith((ctx.input_text)) :
        if len(choices) < 25:
            choices.append({
                    "name": f"{icao}",
                    "value": f"{icao}",
                })
        
    
    
    
await ctx.send(
    choices=choices
)```
nocturne bobcat
#

hm I don't really know then, never tested global autocomplete

#

maybe someone else can test if it works