Autocomplete

typescript
import {
  ApplicationCommandOptionType,
  AutocompleteInteraction,
} from 'discord.js'
import { CommandObject, CommandType, CommandUsage } from '@nyxb/commands'
import Command from '@nyxb/commands/src/command-handler/Command'

export default {
  description: 'Sets your operating system',
  type: CommandType.SLASH,

  options: [
    {
      name: 'operating-system',
      description: 'The operating system you use',
      type: ApplicationCommandOptionType.String,
      required: true,
      // Required for autocomplete to work
      autocomplete: true,
    },
  ],

  autocomplete: (
    command: Command,
    argument: string,
    interaction: AutocompleteInteraction
  ) => {
  // Easier to view the autocomplete functionality with
  // two versions of Windows
    return ['Windows 10', 'Windows 11', 'Mac', 'Linux']
  },

  callback: (options: CommandUsage) => {
    const { text } = options

    return {
      content: `Your operating system is ${text}`,
      ephemeral: true,
    }
  },
} as CommandObject
javascript
const { ApplicationCommandOptionType } = require('discord.js')
const { CommandType } = require('@nyxb/commands')

module.exports = {
  description: 'Sets your operating system',
  type: CommandType.SLASH,

  options: [
    {
      name: 'operating-system',
      description: 'The operating system you use',
      type: ApplicationCommandOptionType.String,
      required: true,
      // Required for autocomplete to work
      autocomplete: true,
    },
  ],

  autocomplete: (command, argument, interaction) => {
  // Easier to view the autocomplete functionality with
  // two versions of Windows
    return ['Windows 10', 'Windows 11', 'Mac', 'Linux']
  },

  callback: ({ text }) => {
    return {
      content: `Your operating system is ${text}`,
      ephemeral: true,
    }
  },
}