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

Try to put a condition on .setAutocomplete but get this error ValidationError: Expected a boolean primitive
4 Replies
d.js toolkit
d.js toolkitā€¢2y 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.
Elyana
Elyanaā€¢2y ago
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;
}
})
),
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;
}
})
),
Unknown User
Unknown Userā€¢2y ago
Message Not Public
Sign In & Join Server To View
Elyana
Elyanaā€¢2y ago
okay got it, thank you
Want results from more Discord servers?
Add your server