• Модуль: im
  • Путь к файлу: ~/bitrix/modules/im/lib/bot.php
  • Класс: BitrixImBot
  • Вызов: Bot::sendPullNotify
static function sendPullNotify($botId, $messageType): bool
{
	if (!BitrixMainLoader::includeModule('pull'))
	{
		return false;
	}

	$botForJs = self::getListForJs();
	if (!isset($botForJs[$botId]))
	{
		return false;
	}

	if ($messageType === 'botAdd' || $messageType === 'botUpdate')
	{

		$userData = CIMContactList::GetUserData([
			'ID' => $botId,
			'DEPARTMENT' => 'Y',
			'USE_CACHE' => 'N',
			'SHOW_ONLINE' => 'N',
			'PHONES' => 'N'
		]);

		return CPullStack::AddShared([
			'module_id' => 'im',
			'command' => $messageType,
			'params' => [
				'bot' => $botForJs[$botId],
				'user' => $userData['users'][$botId],
				'userInGroup' => $userData['userInGroup'],
			],
			'extra' => BitrixImCommon::getPullExtra()
		]);
	}
	elseif ($messageType === 'botDelete')
	{
		return CPullStack::AddShared([
			'module_id' => 'im',
			'command' => $messageType,
			'params' => [
				'botId' => $botId
			],
			'extra' => BitrixImCommon::getPullExtra()
		]);
	}

	return false;
}