This is my main code:
// start of main
return app.start({
minConfidence: 0.8
});
app.sourse = ‘yellomessenger’;
app.log(app.context,‘context’);
//end of main
when I try to print the log this is the message I receive: firsttimeusernotyellowmessenger -x1594876894265- 579129941863219706172663239
Can anyone explain why?
I also tried coding app.log inside app.start it doesn’t seem to solve the issue. Also it doesn’t work inside any other function.
Can you explain why " await app.sendTextMessage(‘Enter valid date’)" is an Parsing error: Unexpected token app
Also how can we find the access the present date in YM
Your log seems to be occurring after the return statement, which usually stops the execution of any function. Please try placing it before your return statement.
await app.sendTextMessage(‘Enter valid date’) -> Is this happening inside an async function? Mostly this means that await is used outside of an async function
let date = new Date()
server time is in UTC, so your date object will be in UTC. Feel free to add or remove timezone differences.
its app.source not app.sourse and you will get yellowmessenger if it is website bot
you will not find context in main you using app.context should use app.getContext() instead of app.context in main
Answering your questions
1.Can anyone explain why?
I also tried coding app.log inside app.start it doesn’t seem to solve the issue. Also it doesn’t work inside any other function.
Ans. app.start should be used in main function only since it is used to start the bot
2.Can you explain why " await app.sendTextMessage(‘Enter valid date’)" is an Parsing error: Unexpected token app
Ans : if you are using await using Async to the function promiselike this return new Promise (async resolve => {})
3.Also how can we find the access the present date in YM
Ans : you can use Date module in javascript