Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

353
Vistas
(closed) How to get the autocomplete query in discord.js

Recently, I came to know about the Autocomplete feature in discord.js@13.6.0 and I wanted to try it out. I was able to do the basics by seeing the answer on this post => How to use AutoComplete in Discord.js v13

I was able to set up the autocomplete and was also able to respond to the autocomplete interaction by using:

client.on('interactionCreate', interaction => {
   if (interaction.isAutocomplete()) {
      interaction.respond([
         {
            name: 'Command Help',
            value: 'help'
         }
      ]);      
   }
})

But my doubt is that is there any way to get the string which the user typed which caused the autocomplete interaction. For example: there is an array of options, and based on what the user typed, I would be able to filter the options and then show the correct ones?

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Yes you can do so very easily by using

interaction.options.getFocused()

this will return whatever the user is currently typing but if you do

interaction.options.getFocused(true)

it will return an object with the the name of the option and the value that the user has typed so far.

You can find the documentation here

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda