When does the `captured` is set ? Or what is the flow order?
efleurine opened this issue · comments
Emmanuel commented
I have those two pieces of codes
1 - In index.js
bot.on("message", (payload, chat, data) => {
const { text } = payload.message;
console.log("in on ", new Date(), data); // 1
chat.say(`Echo: ${text}`); // line 2
});
bot.module(generalModule);
and in module
bot.hear("/about", (payload, chat, data) => {
// Send Help Menu to the user...
console.log("in general", data); // line 3
chat.say(answer["/about"]); // line 4 awswer["/about"] = 'something'
});
I try it many times and most of the times the on message
would appear first. But sometimes the hear message
would appear before it (happen rarely but happen). I tried to register the module first but this does not change anything. So Is there a way to enforce a particular order ?
Hell Cat commented
I think it happen disorder because async feature of javascript