How can i loop the sender message, so that i can wait for the response of the option to be selected which was printed by the for loop Kindly View the Attached Images for an clear example: Image of the example
client.on("friendMessage", (SENDER, MSG) => {
...
...
else{
var countList = 1;
for(var i = 0; i < listOfProducts.length; ++i){
if(listOfProducts[i].is_free_license == false){
client.chatMessage(SENDER, countList +". "+listOfProducts[i].option_text)
ountList++;
}
else{
client.chatMessage(SENDER, result[0].name + ", Unfortunately you can not buy this game as a gift.")
}
}
console.log(countList);
client.on("friendMessage", (SENDER, MSG) => {
countList = countList - 1;
if (MSG === 1) {
client.chatMessage(" has been added to the Cart.")
}
});
}
...
...
}); Kindly drop your suggestions... and thank you for your precious time.