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 toolkit2y 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
ElyanaOP2y 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 User2y ago
Message Not Public
Sign In & Join Server To View
Elyana
ElyanaOP2y ago
okay got it, thank you
Want results from more Discord servers?
Add your server