generated from Baipyrus/DiscordJS-Template
properly extracting parameters
This commit is contained in:
parent
c61a6fd282
commit
aed1d8472e
@ -218,11 +218,13 @@ async function infoResponse(interaction) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/** @param {AutocompleteInteraction} interaction */
|
||||||
* @param {string} guildId
|
async function keywordAutocomplete(interaction) {
|
||||||
* @param {string} focused
|
const { options, guildId } = interaction;
|
||||||
*/
|
|
||||||
async function keywordAutocomplete(guildId, focused) {
|
// Get command options
|
||||||
|
const focused = options.getFocused();
|
||||||
|
|
||||||
// Get list of keywords from database
|
// Get list of keywords from database
|
||||||
/** @type {import('../../models/keywords.js').Keyword[]} */
|
/** @type {import('../../models/keywords.js').Keyword[]} */
|
||||||
const keywords = await Keywords.findAll({
|
const keywords = await Keywords.findAll({
|
||||||
@ -238,12 +240,14 @@ async function keywordAutocomplete(guildId, focused) {
|
|||||||
await interaction.respond(filtered.map((choice) => ({ name: choice.name, value: choice.name })));
|
await interaction.respond(filtered.map((choice) => ({ name: choice.name, value: choice.name })));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/** @param {AutocompleteInteraction} interaction */
|
||||||
* @param {string} guildId
|
async function responseAutocomplete(interaction) {
|
||||||
* @param {string} focused
|
const { options, guildId } = interaction;
|
||||||
* @param {string} keyword
|
|
||||||
*/
|
// Get command options
|
||||||
async function responseAutocomplete(guildId, focused, keyword) {
|
const keyword = options.getString('keyword');
|
||||||
|
const focused = options.getFocused();
|
||||||
|
|
||||||
// Get keyword
|
// Get keyword
|
||||||
/** @type {import('../../models/keywords.js').Keyword} */
|
/** @type {import('../../models/keywords.js').Keyword} */
|
||||||
const found = await Keywords.findOne({
|
const found = await Keywords.findOne({
|
||||||
|
Loading…
Reference in New Issue
Block a user