• Модуль: imbot
  • Путь к файлу: ~/bitrix/modules/imbot/lib/bot/support24.php
  • Класс: BitrixImBotBotSupport24
  • Вызов: Support24::sendRequestFinalizeSession
static function sendRequestFinalizeSession(array $params = [])
{
	if (!MainLoader::includeModule('im'))
	{
		return false;
	}

	if (!MainLoader::includeModule('bitrix24'))
	{
		return false;
	}

	if (!self::getBotId())
	{
		return false;
	}

	(new DialogSession)->clearSessions(['BOT_ID' => self::getBotId()]);

	$currentLicence = CBitrix24::getLicenseType(CBitrix24::LICENSE_TYPE_CURRENT);

	if (self::getSupportLevel() == self::SUPPORT_LEVEL_PAID)
	{
		$currentCode = Option::get('imbot', self::OPTION_BOT_PAID_CODE, "");
	}
	else
	{
		$currentCode = Option::get('imbot', self::OPTION_BOT_FREE_CODE, "");
	}

	$message = $params['MESSAGE'] ?? '';

	$http = self::instanceHttpClient();
	$response = $http->query(
		'clientRequestFinalizeSession',
		[
			'BOT_ID' => self::getBotId(),
			'CURRENT_LICENCE_TYPE' => $currentLicence,
			'CURRENT_LICENCE_NAME' => CBitrix24::getLicenseName($currentLicence),
			'CURRENT_BOT_CODE' => $currentCode,
			'MESSAGE' => $message,
		],
		false
	);

	return $response !== false && !isset($response['error']);
}