help, please! i have a task to output several messages in a row in bot like that:
P: hello
Bot: Good
Bot: Morning!
but i can't find way how to make 'output.answer' do it
There is a code
main();
async function main() {
const dock = await dockStart();
const nlp = dock.get('nlp');
await nlp.train();
webchatChannel(nlp);
}
function webchatChannel(nlp) {
nlp.onIntent = async (nlp, input) => {
try {
if (input.intent === 'greetings.hello') {
const hours = new Date().getHours();
const output = input;
if(hours < 12) {
output.answer = 'Good morning!'
} else if(hours < 17) {
output.answer = 'Good afternoon!';
} else {
output.answer = 'Good evening!';
}
return output;
}
return input;
} catch (e) {
console.log("*** ERROR attachWebsiteChannel ***", e, e.stack);
input.answer = "Something is wrong, please reload the page and try again later";
}
};
}