AutoComplete event not firing

Hello, (its me again), i've been trying to get the autocomplete property to work but i cant get it to work. No event is fired at all, and all options just come up as 'failed to load' Djs v14.3.0, node v18.8.0
2 Replies
d.js docs
d.js docs3y ago
• What's your exact discord.js npm list discord.js and node node -v version? • Post the full error stack trace, not just the top part! • Show your code! • Explain what exactly your issue is. • Not a discord.js issue? Check out #useful-servers.
treble/luna
treble/lunaOP3y ago
Code:
if (interaction.type === InteractionType.ApplicationCommandAutocomplete) {
console.log('test')
if (interaction.commandName === 'modal') {
console.log('test')
const focusedValue = interaction.options.getFocused();
console.log(focusedValue)
const choices =["please", "work"]

const filtered = choices.filter(choice => choice.startsWith(focusedValue));
await interaction.respond(
filtered.map(choice => ({ name: choice, value: choice })),
);

}
return;
}
if (interaction.type === InteractionType.ApplicationCommandAutocomplete) {
console.log('test')
if (interaction.commandName === 'modal') {
console.log('test')
const focusedValue = interaction.options.getFocused();
console.log(focusedValue)
const choices =["please", "work"]

const filtered = choices.filter(choice => choice.startsWith(focusedValue));
await interaction.respond(
filtered.map(choice => ({ name: choice, value: choice })),
);

}
return;
}
so, it only fires when i enter other options first then it works but i have to specifically skip that option (its set to required), fill in the other values and then the autocomplete will work visualised: https://bork.treble-is-fluffy.gay/floof4b76.mp4 no, just defining variables its at the top of the file but it does work sometimes but i have the feeling the required fields mess it up the event does get called but like i now set the required to false, and now it works flawlessly and when i only set that option to be required, it also works but i have 3 required options if i set all three, it breaks its also very inconsistent to replicate
Want results from more Discord servers?
Add your server