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 ?
I have those two pieces of codes
1 - In
index.js
and in module
I try it many times and most of the times the
on message
would appear first. But sometimes thehear 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 ?