• Модуль: im
  • Путь к файлу: ~/bitrix/modules/im/lib/bot.php
  • Класс: BitrixImBot
  • Вызов: Bot::getListForJs
static function getListForJs()
{
	$result = Array();
	$bots = self::getListCache();
	foreach ($bots as $bot)
	{
		$type = 'bot';
		$code = $bot['CODE'];

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

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

		$result[$bot['BOT_ID']] = Array(
			'id' => $bot['BOT_ID'],
			'code' => $code,
			'type' => $type,
			'openline' => $bot['OPENLINE'] == 'Y',
		);
	}

	return $result;
}