#Need help with autocomplete interaction
1 messages · Page 1 of 1 (latest)
okey
abc
abc 🤔
console.log(interaction) (it's probably not an Interaction)
Tag suggestion for @flint patio:
The order of function parameters must match between definition and function call.
function execute(client, message, args) { ... };
execute(message, client, args);
• mismatch! you pass a Message where the client is expected
• mismatch! you pass the Client where a Message is expected
oky
not very understandable. so how do i do it?
@worldly mortar
also see tag sent by wheelchair user (translate it)
Right, so
https://discord.js.org/#/docs/discord.js/14.0.3/class/AutocompleteInteraction
basically check the guide for how to use autocomplete interactions:
https://discordjs.guide/interactions/autocomplete.html
you're supposed to respond() with the choices, not replying with a message.
I didn't understand anything of what you said. I already do most things by looking at the documentation.
hımm
no, it seems that you are responding to autocomplete interaction with reply/message, while it expects you to send the CHOICES to the user to select.
I understood. So what do I do to fix this problem?
respond with the choices, use read the guide to understand it https://discordjs.guide/interactions/autocomplete.html
I more or less understood. So the problem is elsewhere?
module.exports = interaction => {
if (interaction.commandName == "yardım") {
const focusedValue = interaction.options.getFocused()
const choices = Array.from(interaction.client.commands.keys())
const filtered = choices.filter(choice => choice.startsWith(focusedValue))
const result = filtered.map(choice => ({ name: choice, value: choice }))
interaction.respond(result)
}
}
``` @smoky narwhal
Is that the problem here?
this should work? but that was not what we looked at.
well, the code is correct, but how do you call this?
ah
how do you say it?
I call AutoComplete here. So I guess the problem is here.
@smoky narwhal
you here?
Need help with autocomplete interaction
you need to help yourself
use the guide
for the 3rd time or whatever
use the guide to get an understanding of it and then look at what you're doing differently
My friends and I struggled to solve the problem and
We looked at the document but couldn't find it.
you have to call this when you get the autocomplete interaction to send the choices to the user of the command
OK. I have only one question. What is the problem caused by? From the command definition? Or is it AutoComplete?
hemmm
Which problem exactly?
I told you this already
AutocompleteInteraction (your interaction in this case) don't have a reply() method
autocompleteinteraction => .respond() with choices => then you are probably doing .execute() (in your command handler) and replying to the ChatInputCommandInteraction (the slash command interaction)
By not passing autocomplete interaction to execute()