Skip to content Skip to sidebar Skip to footer

Overlapping Commands?

I'm trying to make a fun little discord chat bot with JavaScript and node.js and I'd like to put in a specific command without it affecting another one I already have set up. She w

Solution 1:

else/if chains work beautifully for this actually!!!

if(message.content.toLowerCase().includes("rei do you like girls")) {
            message.channel.send("Yes, absolutely. Girls are just... yeah...");
         }
      elseif (message.content.toLowerCase().includes("rei are")) {
          var response = areResponses [Math.floor(Math.random()*areResponses.length)];

          message.channel.send(response).then().catch(console.error);
        }

All you need to do is put the command that would overlap with the larger commands at the very bottom of the else if chain, and then you're good!!

Post a Comment for "Overlapping Commands?"