Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

64
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!