6 Replies
Unknown User
Unknown User16mo ago
Message Not Public
Sign In & Join Server To View
MrMythical
MrMythical16mo ago
@ashurabln please do this :D
Ashura
Ashura16mo ago
no errors , autocomplete is just empty
d.js docs
d.js docs16mo 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
Ashura16mo ago
logged it , got this
Ashura
Ashura16mo 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?