机器人框架检测用户何时空闲

Bot framework detect when user is idling

目前我需要我的机器人在用户闲置 5 分钟后自动发送消息。这是如何实现的。 谢谢

您可以根据代码中的计时器向用户发送主动消息。

Proactive messages can be useful in a variety of scenarios. If a bot sets a timer or reminder, it will need to notify the user when the time arrives. Or, if a bot receives a notification from an external system, it may need to communicate that information to the user immediately. For example, if the user has previously asked the bot to monitor the price of a product, the bot will alert the user if it receives notification that the price of the product has dropped by 20%. Or, if a bot requires some time to compile a response to the user's question, it may inform the user of the delay and allow the conversation to continue in the meantime. When the bot finishes compiling the response to the question, it will share that information with the user.

更多信息: https://docs.microsoft.com/en-us/bot-framework/dotnet/bot-builder-dotnet-proactive-messages

代码示例: https://github.com/Microsoft/BotBuilder-Samples/tree/master/CSharp/core-proactiveMessages