• Модуль: imbot
  • Путь к файлу: ~/bitrix/modules/imbot/lib/event.php
  • Класс: BitrixImBotEvent
  • Вызов: Event::onSessionVote
static function onSessionVote($params)
{
	$botList = [];
	if (empty($params['CHAT']))
	{
		$botList[] = (int)$params['DIALOG_ID'];
	}
	elseif (!empty($params['RELATION']))
	{
		foreach ($params['RELATION'] as $relation)
		{
			if ($relation['EXTERNAL_AUTH_ID'] === BitrixImBot::EXTERNAL_AUTH_ID)
			{
				$botList[(int)$relation['USER_ID']] = (int)$relation['USER_ID'];
			}
		}
	}

	$result = true;
	foreach ($botList as $botId)
	{
		$botData = BitrixImBot::getCache($botId);
		if (!$botData)
		{
			continue;
		}

		if (
			class_exists($botData['CLASS'])
			&& method_exists($botData['CLASS'], 'onSessionVote')
		)
		{
			$params['BOT_ID'] = $botId;

			Log::write($params, 'SESSION VOTE');

			$result = call_user_func([$botData['CLASS'], 'onSessionVote'], $params);
		}
	}

	return $result;
}