1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
ReplyService.php
См. документацию.
1<?php
2
3namespace Bitrix\Im\V2\Message\Reply;
4
5use Bitrix\Im\V2\Chat;
6use Bitrix\Im\V2\Common\ContextCustomer;
7use Bitrix\Im\V2\Message;
8use Bitrix\Im\V2\Result;
9
11{
12 use ContextCustomer;
13
19 public function createMessage(Message $replyingMessage, string $comment): Result
20 {
21 $result = new Result();
22 if (!$replyingMessage->getChat()->checkAccess($this->getContext()->getUserId())->isSuccess())
23 {
24 return $result->addError(new Chat\ChatError(Chat\ChatError::ACCESS_DENIED));
25 }
26
27 $messageId = \CIMMessenger::Add([
28 "MESSAGE_TYPE" => $replyingMessage->getChat()->getType(),
29 "MESSAGE" => $comment,
30 "PARAMS" => [
31 "REPLY_ID" => $replyingMessage->getMessageId(),
32 ],
33 "TO_CHAT_ID" => $replyingMessage->getChat()->getChatId(),
34 "FROM_USER_ID" => $this->getContext()->getUserId(),
35 ]);
36
37 if (!$messageId)
38 {
40 }
41
42 return $result->setResult(new Message($messageId));
43 }
44
45}
if(! $messageFields||!isset($messageFields['message_id'])||!isset($messageFields['status'])||!CModule::IncludeModule("messageservice")) $messageId
Определения callback_ismscenter.php:26
const ACCESS_DENIED
Определения ChatError.php:19
createMessage(Message $replyingMessage, string $comment)
Определения ReplyService.php:19
getMessageId()
Определения Message.php:806
getChat()
Определения Message.php:867
Определения result.php:20
$result
Определения get_property_values.php:14
Определения Uuid.php:3
$comment
Определения template.php:15