What is the right way to message the user after 120 seconds of inactivity in my messenger bot?

烂漫一生 提交于 2019-12-24 07:04:38

问题


I am using the bot framework to build a quiz bot and I want the person to get a message from the bot if they become inactive in 2 mins. 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)

来源:https://stackoverflow.com/questions/41569285/what-is-the-right-way-to-message-the-user-after-120-seconds-of-inactivity-in-my

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!