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

65
Vistas
If-clause turns true despite wrong customid

Im currently making a ticket system, where after choosing the category in a selection menu, the old selection menu is replaced with one for the subcategory. This is the code for the start of my main category event, which reads out which main category was selected. The same thing however also triggers when selecting a subcategory.

client.on('interactionCreate', async interaction => { 
    console.log(interaction.customId); //remove
    if(!interaction.customId === 'staff_selection_menu' || !interaction.isSelectMenu()) return;
    console.log(`[${new Date().toLocaleTimeString()}] Staff ticket category received.`);

After adding a console.log to check the customId of the interaction, I get the following

role_selection_menu //the logged customId of the interaction
[17:35:51] Staff ticket category received. //The log that shows the category event was called, shouldnt happen
[17:35:51] Staff ticket subcategory received.//The log that shows the subcategory event was called, should happen

As you can see despite logging that the id was 'role_selection_menu' it passed the if-clause that should return on anything but 'staff_selection_menu'

Im pretty sure this is some idiotic mistake, but I tried everything, and for the life of me, cant find out why this is happening.

about 4 years ago · Juan Pablo Isaza
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