Not displaying the log

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

  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.

  2. Can you explain why " await app.sendTextMessage(‘Enter valid date’)" is an Parsing error: Unexpected token app

  3. Also how can we find the access the present date in YM

  1. 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.

  2. 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

  3. let date = new Date() :slight_smile:
    server time is in UTC, so your date object will be in UTC. Feel free to add or remove timezone differences.

1 Like

Other helpful tips:

You could try accessing app.source ( for understanding which channel was used to send the message )

Hi ganesh,

Here you are doing following errors

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

1 Like