setTimeout() in nodejs not work

Hello, I have a problem with the code. I want the first command to be executed, then after two seconds the second one is executed, but I tried the code in the emulator to be executed, but when writing it in the project, it is not executed

function Process(textUser, number){
textUser= textUser.toLowerCase();
var models = ;

if (textUser.includes(“HI”)) {
var model = whatsappModel.SendLogo(number);

  var modelList = whatsappModel.MessageList(number);
   models.push(model);
  setTimeout(async () => { 
 models.push(modelList); }, 2000);

}

how are you checking whether or not it is executed? it looks like the thing it does after two seconds is only to push something into the end of models which is never used again.

I have tried it and run it. It implements the first command, and it sends a text with an image. The second command sends a message in the form of a list, but the second command is not executed.

can you point out the code that does the second command? I didn’t see it above

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.