繁体   English   中英

Botman Studio对话时间

[英]Botman Studio conversation_cache_time

我正在Botman Studio中使用电报API做一个聊天机器人,该机器人集成了laravel和php。 我想计算用户使用聊天机器人的时间。

当用户键入“ / start”时,与机器人的对话开始:

在此处输入图片说明

我希望从那里开始计算将其输入数据库的时间,以便了解用户与聊天机器人进行交互的时间。

我如何在对话中做到这一点?

 <?php return [ /* |-------------------------------------------------------------------------- | Conversation Cache Time |-------------------------------------------------------------------------- | | BotMan caches each started conversation. This value defines the | number of minutes that a conversation will remain stored in | the cache. | */ 'conversation_cache_time' => 1, /* |-------------------------------------------------------------------------- | User Cache Time |-------------------------------------------------------------------------- | | BotMan caches user information of the incoming messages. | This value defines the number of minutes that this | data will remain stored in the cache. | */ 'user_cache_time' => 1, ]; 

在这里,我确定闲置一分钟后,对话会停止,我希望在数据库中对话停止的同时存储时间。 我该如何为其建立条件?

好吧,如果您有办法知道用户退出了对话,则可以存储用户开始对话的日期时间和存储用户结束对话的日期时间。 然后,如果您想知道用户花费了多少,只需减去endDate-beginDate。 您可以使用Carbon来简化Datetime的生活

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM