i have tried using the following as the code to get a list. example 1:
And i haven't had any success. With the example 1, i em getting the following (image)
with example
When i type it [], anyone got an idea what im doing wrong here?
Code Line 19 - 35
Can't get the filter to display what matches to the result
I got the Array list to actually work, i didn't realize it was CaSe SeNsItIvE until recently. Sorry for wasting peoples reading time! Now to get it to be lower case so it doesn't have to be CaSe SeNsItIvE
async autocomplete(interaction) {
con.query('select typeName FROM invTypes JOIN invGroups ON invGroups.groupID=invTypes.groupID JOIN invMarketGroups ON invMarketGroups.marketGroupID = invTypes.marketGroupID and invGroups.categoryID = 6 AND invTypes.published =1', function (err, results) {
if (err) throw err;
shipList(results)
})
async function shipList(results) {
const list = results.map(list => list.typeName)
const focusedValue = interaction.options.getFocused();
const choices = list.filter(list => list);
const filtered = choices.filter(choice => choice.startsWith(focusedValue));
await interaction.respond(
filtered.map(choice => ({ name: choice, value: choice })).slice(0, 25),
);
}
},