簡體   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