• Модуль: im
  • Путь к файлу: ~/bitrix/modules/im/lib/V2/Chat.php
  • Класс: BitrixImV2Chat
  • Вызов: Chat::addUsers
public function addUsers(array $userIds, array $managerIds = [], ?bool $hideHistory = null, bool $withMessage = true, bool $skipRecent = false): self
{
	if (empty($userIds) || !$this->getChatId())
	{
		return $this;
	}

	$usersToAdd = $this->filterUsersToAdd($userIds);

	if (empty($usersToAdd))
	{
		return $this;
	}

	$relations = $this->getRelations();
	$this->addUsersToRelation($usersToAdd, $managerIds, $hideHistory);
	$this->updateStateAfterUsersAdd($usersToAdd)->save();
	$this->sendPushUsersAdd($usersToAdd, $relations);
	$this->sendEventUsersAdd($usersToAdd);
	if ($withMessage)
	{
		$this->sendMessageUsersAdd($usersToAdd, $skipRecent);
	}

	return $this;
}