#Slash command autocomplete glitched?
1 messages · Page 1 of 1 (latest)
you want the autocomplete to be shown before the user types something?
Thats normal for autocomplete
If your list of options is less than 25 you can use choices instead
bruh it always worked without typing as far as i remember
don't know if i did smth wrong
Don't know what to tell you, autocomplete function does not fire before you type something, therefore it won't show up. However choices always shows all the options available without typing.
show the autocomplete code
let me try
it did for me
@diff.autocomplete("name")
async def namecomplete(
self, inter: disnake.ApplicationCommandInteraction, string: str
):
string = string.lower()
canvas_dict = {"e": "earth", "1": "1bit", "m": "moon"}
guildFolders = [
filename
for filename in os.listdir("./factions/")
if filename.startswith(f"{inter.guild.id}")
]
templates = [
f'{temp.split("_")[5] if temp.split("_")[5] != ".png" else "0"}% | {temp.split("_")[1]} | {canvas_dict[temp.split("_")[4]]}'
for temp in os.listdir(f"./factions/{guildFolders[0]}")
if temp.endswith(".png")
]
for i in range(0, len(templates)):
for j in range(i+1, len(templates)):
if(float(templates[i].split(" | ")[0].replace('%', '')) < float(templates[j].split(" | ")[0].replace('%', ''))):
temp = templates[i];
templates[i] = templates[j];
templates[j] = temp;
return [lang for lang in templates if string in lang.lower()][0:25]```
i'm starting to think discord api is kinda glitched or they updated something
its the list comprehension at the end
it won't return something because string is "" therefore its in none of the templates
if len(user_input) == 0: return templates[:25]
try adding that before your return statement
I have the same problem hmm
didn't work. "" is actually in all of the templates, it always worked as usual
it doesn't show autocomplete the first time, tho the library receives the interaction
yeah it did receive for me too, it just didn't return the list to the client?
It's something that has started happening for me as well. And not just autocomplete, disnake.Roles aren't appearing until I start typing
it was working for a friend, in this bot, and now it's not working again
(he uses disnake too)
not sure if it's a disnake problem or w/ discord api
even optional arguments aren't appearing until I hit "space" after the command
What do you mean "" is in all of the templates?
the list comprehension in the final is not wrong
it's always worked like that
"" is in all the templates
print it to sdout
looks like it's a discord api problem
the list comprehension
because disnake does send the callback request
pretty sure its going to be []
can you try please type the command with no arguments
like this
then go to any server and go back
it's very weird
maybe it should be reported to https://github.com/discord/discord-api-docs
oh so it works on mobile
what web/desktop version are you using?
Discord does receive the interaction callback
so it's definitely a discord problem
Ptb 161355 (1c9ef5c)
Host 1.0.1020 (27412)
(not sure if those are versions)
hmm ptb
so ptb is some versions behind canary
let me try using stable version
same issue
What version of disnake?