Setting up Autocomplete
A search-based command needs an autocomplete for a user to reference the results, and the user can use that result for a command option.
Using autocomplete function
autocomplete functionconst { NoCliCommandType } = require("nocli-handler.js");
/**
* @type {import("nocli-handler.js").ICommand}
*/
const Command = {
description: "Asks what device you are using",
type: NoCliCommandType.Slash,
expectedArgs: '<device>',
minArgs: 1,
maxArgs: 1,
autocomplete: (interaction, command, args) => { // <-- Creates a new
// Autocomplete instance
return ["Desktop", "Laptop", "Phone", "Tablet"]
},
callback: ({ client, interaction, args, text }) => {
return `You chose ${args.join(' ')}`;
}
}
module.exports = Command;End Result:

Last updated
