#Is there a way to setAutocomplete(true) in function of another option value?

4 messages · Page 1 of 1 (latest)

misty harness
#

Try to put a condition on .setAutocomplete but get this error
ValidationError: Expected a boolean primitive

storm cradleBOT
#

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

misty harness
#
data : new SlashCommandBuilder()
        .setName(key)
        .setDescription("Help you track what you have stack on your production machines")
        .addSubcommand(
            new SlashCommandSubcommandBuilder()
            .setName("account")
            .setDescription("Manage your accounts")
            .addStringOption(
                new SlashCommandStringOption()
                .setName("action")
                .setDescription("What do you wish to do ?")
                .setRequired(true)
                .addChoices({
                    name : "Add",
                    value : "add"
                }, {
                    name : "Modify",
                    value : "modify"
                }, {
                    name : "Delete",
                    value : "delete"
                })
            )
            .addStringOption(
                new SlashCommandStringOption()
                .setName("account")
                .setDescription("Enter the account name")
                .setRequired(true)
                .setAutocomplete((interaction, option)=>{
                    if (interaction.options.getString('action') === 'delete') {
                        return true;
                    } else {
                        return false;
                    }
                })
            ),
flint topaz
#

only accepts true or false