• Модуль: imbot
  • Путь к файлу: ~/bitrix/modules/imbot/lib/service/notifier.php
  • Класс: BitrixImBotServiceNotifier
  • Вызов: Notifier::changeChannelOwner
static function changeChannelOwner(int $chatId, int $ownerId, int $previousOwnerId): void
{
	$chat = new CIMChat(0);
	$chat->addUser($chatId, $ownerId, true, true, true);
	$chat->setOwner($chatId, $ownerId, false);

	ImModelChatTable::update($chatId, ['ENTITY_ID' => $ownerId]);

	MainApplication::getConnection()->queryExecute(
		'UPDATE '. ImModelMessageTable::getTableName()
		.' SET AUTHOR_ID = '. $ownerId
		.' WHERE AUTHOR_ID = '. $previousOwnerId.' AND CHAT_ID = '.$chatId
	);
}