Skip to content

Commit

Permalink
Updates
Browse files Browse the repository at this point in the history
  • Loading branch information
remdex committed Jun 5, 2023
1 parent dd8ca6f commit 180c9de
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions bootstrap/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,16 @@ public static function incommingChatStarted($params)
isset($params['data']['message']['platform']) &&
$params['data']['message']['platform'] == 'whatsapp'
) {
$messageBird = LiveHelperChatExtension\messagebird\providers\erLhcoreClassModelMessageBirdMessage::findOne(['sort' => 'id DESC', 'filter' => ['conversation_id' => $params['data']['message']['conversationId']]]);
$messageBird = LiveHelperChatExtension\messagebird\providers\erLhcoreClassModelMessageBirdMessage::findOne(['sort' => 'id DESC', 'filtergt' => ['created_at' => (time() - 24 * 3600)], 'filter' => ['conversation_id' => $params['data']['message']['conversationId']]]);

if (is_object($messageBird) && $messageBird->dep_id > 0) {
// Chat
$params['chat']->dep_id = $messageBird->dep_id;
$params['chat']->updateThis(['update' => ['dep_id']]);

// Save template only if it was not assigned to any chat yet
if ($messageBird->chat_id == 0) {
// Chat
$params['chat']->dep_id = $messageBird->dep_id;
$params['chat']->updateThis(['update' => ['dep_id']]);

// Save template message first before saving initial response in the lhc core
$msg = new erLhcoreClassModelmsg();
$msg->msg = $messageBird->message;
Expand Down

0 comments on commit 180c9de

Please sign in to comment.