• Модуль: im
  • Путь к файлу: ~/bitrix/modules/im/lib/V2/Entity/User/UserBot.php
  • Класс: BitrixImV2EntityUserUserBot
  • Вызов: UserBot::prepareDataForRest
protected function prepareDataForRest(array $botData): array
{
	$type = 'bot';
	$code = $botData['CODE'];

	if ($botData['TYPE'] === self::BOT_TYPE['TYPE_HUMAN'])
	{
		$type = 'human';
	}
	else if ($botData['TYPE'] === self::BOT_TYPE['TYPE_NETWORK'])
	{
		$type = 'network';

		if ($botData['CLASS'] === 'BitrixImBotBotSupport24')
		{
			$type = 'support24';
			$code = 'network_cloud';
		}
		else if ($botData['CLASS'] === 'BitrixImBotBotPartner24')
		{
			$type = 'support24';
			$code = 'network_partner';
		}
		else if ($botData['CLASS'] === 'BitrixImBotBotSupportBox')
		{
			$type = 'support24';
			$code = 'network_box';
		}
	}
	else if ($botData['TYPE'] === self::BOT_TYPE['TYPE_OPENLINE'])
	{
		$type = 'openline';
	}
	else if ($botData['TYPE'] === self::BOT_TYPE['TYPE_SUPERVISOR'])
	{
		$type = 'supervisor';
	}

	return [
		'code' => $code,
		'type' => $type,
		'appId' => $botData['APP_ID'],
		'isSupportOpenline' => $botData['OPENLINE'] === 'Y',
	];
}