6 Replies
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
MrMythical
MrMythical2y ago
@ashurabln please do this :D
Ashura
AshuraOP2y ago
no errors , autocomplete is just empty
d.js docs
d.js docs2y ago
If you aren't getting any errors, try to place console.log checkpoints throughout your code to find out where execution stops. • Once you do, log relevant values and if-conditions • More sophisticated debugging methods are breakpoints and runtime inspections: learn more
Ashura
AshuraOP2y ago
logged it , got this
Ashura
AshuraOP2y ago
ill show u my autocomplete code
async autocomplete(interaction) {
const focusedValue = interaction.options.getFocused();
switchSchema.find({}, 'Switchs', (err, switches) => {
if (err) {
console.log(err);
return;
}
let choices = switches.map((s) => s.switchSchema);
console.log(choices)
if (!choices){
choices === ["Sem switches disponiveis"]
}
console.log(choices)
const filtered = choices.filter(choice => choice.toLowerCase().startsWith(focusedValue.toLowerCase())).slice(0, 25);
interaction.respond(
filtered.map(choice => ({ name: choice, value: choice })),
);
});

},
async autocomplete(interaction) {
const focusedValue = interaction.options.getFocused();
switchSchema.find({}, 'Switchs', (err, switches) => {
if (err) {
console.log(err);
return;
}
let choices = switches.map((s) => s.switchSchema);
console.log(choices)
if (!choices){
choices === ["Sem switches disponiveis"]
}
console.log(choices)
const filtered = choices.filter(choice => choice.toLowerCase().startsWith(focusedValue.toLowerCase())).slice(0, 25);
interaction.respond(
filtered.map(choice => ({ name: choice, value: choice })),
);
});

},
what changes do you suggest me?
Want results from more Discord servers?
Add your server