• Модуль: imconnector
  • Путь к файлу: ~/bitrix/modules/imconnector/lib/interactivemessage/input.php
  • Класс: BitrixImConnectorInteractiveMessageInput
  • Вызов: Input::sessionNew
protected function sessionNew($chatId, $userId, $message = ''): Result
{
	$result = new Result();

	if (Loader::includeModule('imopenlines'))
	{
		/** @var BitrixImOpenLinesServicesChatDispatcher $chatDispatcher */
		$chatDispatcher = ServiceLocator::getInstance()->get('ImOpenLines.Services.ChatDispatcher');
		$chat = $chatDispatcher->getChat((int)$chatId);

		$resultSessionNew = $chat->restartSession($userId, $message);

		if ($resultSessionNew->isSuccess())
		{
			$result->setResult(true);
		}
		else
		{
			$result->addErrors($resultSessionNew->getErrors());
		}
	}
	else
	{
		$result->addError(new Error(
			'Failed to load the open lines module',
			'IMCONNECTOR_INTERACTIVE_MESSAGE_ERROR_NOT_LOAD_MODULES_IMOPENLINES',
			__METHOD__
		));
	}

	return $result;
}