Skip to content

Commit

Permalink
Random response for not replying operator
Browse files Browse the repository at this point in the history
  • Loading branch information
remdex committed Dec 20, 2022
1 parent 0a0bccd commit d31b3d9
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,7 @@
'timeout_op_reply_message_1' => array(
'type' => 'textarea',
'height' => '86px',
'trans' => erTranslationClassLhTranslation::getInstance()->getTranslation('abstract/proactivechatinvitation', 'Message for timeout [1]'),
'trans' => erTranslationClassLhTranslation::getInstance()->getTranslation('abstract/proactivechatinvitation', 'Message for timeout [1], use ||| to separate random messages.'),
'required' => false,
'hidden' => true,
'main_attr' => 'bot_configuration_array',
Expand All @@ -413,7 +413,7 @@
'timeout_op_reply_message_2' => array(
'type' => 'textarea',
'height' => '86px',
'trans' => erTranslationClassLhTranslation::getInstance()->getTranslation('abstract/proactivechatinvitation', 'Message for timeout [2]'),
'trans' => erTranslationClassLhTranslation::getInstance()->getTranslation('abstract/proactivechatinvitation', 'Message for timeout [2], use ||| to separate random messages.'),
'required' => false,
'hidden' => true,
'main_attr' => 'bot_configuration_array',
Expand All @@ -423,7 +423,7 @@
'timeout_op_reply_message_3' => array(
'type' => 'textarea',
'height' => '86px',
'trans' => erTranslationClassLhTranslation::getInstance()->getTranslation('abstract/proactivechatinvitation', 'Message for timeout [3]'),
'trans' => erTranslationClassLhTranslation::getInstance()->getTranslation('abstract/proactivechatinvitation', 'Message for timeout [3], use ||| to separate random messages.'),
'required' => false,
'hidden' => true,
'main_attr' => 'bot_configuration_array',
Expand All @@ -433,7 +433,7 @@
'timeout_op_reply_message_4' => array(
'type' => 'textarea',
'height' => '86px',
'trans' => erTranslationClassLhTranslation::getInstance()->getTranslation('abstract/proactivechatinvitation', 'Message for timeout [4]'),
'trans' => erTranslationClassLhTranslation::getInstance()->getTranslation('abstract/proactivechatinvitation', 'Message for timeout [4], use ||| to separate random messages.'),
'required' => false,
'hidden' => true,
'main_attr' => 'bot_configuration_array',
Expand All @@ -443,7 +443,7 @@
'timeout_op_reply_message_5' => array(
'type' => 'textarea',
'height' => '86px',
'trans' => erTranslationClassLhTranslation::getInstance()->getTranslation('abstract/proactivechatinvitation', 'Message for timeout [5]'),
'trans' => erTranslationClassLhTranslation::getInstance()->getTranslation('abstract/proactivechatinvitation', 'Message for timeout [5], use ||| to separate random messages.'),
'required' => false,
'hidden' => true,
'main_attr' => 'bot_configuration_array',
Expand Down Expand Up @@ -498,7 +498,7 @@
)),
'close_message' => array(
'type' => 'textarea',
'trans' => erTranslationClassLhTranslation::getInstance()->getTranslation('abstract/proactivechatinvitation', 'Message to visitor on chat close'),
'trans' => erTranslationClassLhTranslation::getInstance()->getTranslation('abstract/proactivechatinvitation', 'Message to visitor on chat close. Use ||| to separate random messages.'),
'height' => '86px',
'required' => false,
'hidden' => true,
Expand All @@ -508,7 +508,7 @@
)),
'offline_message' => array(
'type' => 'textarea',
'trans' => erTranslationClassLhTranslation::getInstance()->getTranslation('abstract/proactivechatinvitation', 'Message to visitor if department is offline'),
'trans' => erTranslationClassLhTranslation::getInstance()->getTranslation('abstract/proactivechatinvitation', 'Message to visitor if department is offline. Use ||| to separate random messages.'),
'height' => '86px',
'required' => false,
'hidden' => true,
Expand All @@ -518,7 +518,7 @@
)),
'multilanguage_message' => array(
'type' => 'textarea',
'trans' => erTranslationClassLhTranslation::getInstance()->getTranslation('abstract/proactivechatinvitation', 'Message to visitor if operator speaks same language as visitor.'),
'trans' => erTranslationClassLhTranslation::getInstance()->getTranslation('abstract/proactivechatinvitation', 'Message to visitor if operator speaks same language as visitor. Use ||| to separate random messages.'),
'height' => '86px',
'required' => false,
'hidden' => true,
Expand Down
11 changes: 10 additions & 1 deletion lhc_web/lib/models/lhabstract/erlhabstractmodelautoresponder.php
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,16 @@ public function __get($var)
case 'multilanguage_message':
$this->{$var} = null;
if (isset($this->bot_configuration_array[$var])) {
$this->{$var} = $this->bot_configuration_array[$var];

$msgData = explode('|||', $this->bot_configuration_array[$var]);

if (count($msgData) > 1) {
$item = trim($msgData[mt_rand(0,count($msgData)-1)]);
} else {
$item = $this->bot_configuration_array[$var];
}

$this->{$var} = $item;
}
return $this->{$var};
break;
Expand Down

0 comments on commit d31b3d9

Please sign in to comment.