What is the correct way to message a user after 120 seconds of inactivity in my boxing messenger?

I use the bot platform to create a bot quiz, and I want a person to receive a message from the bot if they stop working after 2 minutes. When i tried

bot.dialog('/', [(session)=>{
    session.dialogData.inactive = setTimeout(()=>{
        session.send('You there?')
    },30000)
}])

It gives me this error

TypeError: Converting circular structure to JSON
    at Object.stringify (native)
    at addWrite (D:\bots\zupquiz\node_modules\botbuilder\lib\bots\ChatConnector.js:261:29)
    at ChatConnector.saveData (D:\bots\zupquiz\node_modules\botbuilder\lib\bots\ChatConnector.js:276:21)
    at D:\bots\zupquiz\node_modules\botbuilder\lib\bots\UniversalBot.js:405:21
    at UniversalBot.tryCatch (D:\bots\zupquiz\node_modules\botbuilder\lib\bots\UniversalBot.js:425:13)
    at UniversalBot.saveStorageData (D:\bots\zupquiz\node_modules\botbuilder\lib\bots\UniversalBot.js:402:14)
    at Object.onSave (D:\bots\zupquiz\node_modules\botbuilder\lib\bots\UniversalBot.js:266:27)
    at Session.sendBatch (D:\bots\zupquiz\node_modules\botbuilder\lib\Session.js:381:22)
    at Timeout.<anonymous> (D:\bots\zupquiz\node_modules\botbuilder\lib\Session.js:513:23)
    at ontimeout (timers.js:365:14)
    at tryOnTimeout (timers.js:237:5)
    at Timer.listOnTimeout (timers.js:207:5)
0
source share

Source: https://habr.com/ru/post/1667635/


All Articles