#autocomplete on interaction create

5 messages · Page 1 of 1 (latest)

fast fulcrum
#

I'm trying to add a command that uses autocomplete, i think it's not working because of this code. how can i make it so that it checks if a command is autocomplete and then runs it?

client.on(Events.InteractionCreate, async interaction => {
    if (!interaction.isChatInputCommand()) return;

    const command = client.commands.get(interaction.commandName);

    if (!command) return;

    try {
        await command.execute(interaction);
    } catch (error) {
        console.error(error);
        if (interaction.replied || interaction.deferred) {
            await interaction.followUp({ content: 'There was an error while executing this command!', ephemeral: true });
        } else {
            await interaction.reply({ content: 'There was an error while executing this command!', ephemeral: true });
        }
    }
});
thorny tree
#

• 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.

fast fulcrum
#

discord.js 14.8.0
node 18.15.0

fast fulcrum
#

thank you, that looks like the solution