• Модуль: imbot
  • Путь к файлу: ~/bitrix/modules/imbot/lib/bot/network.php
  • Класс: BitrixImBotBotNetwork
  • Вызов: Network::unRegister
static function unRegister($code = '', $notifyController = true)
{
	if (!MainLoader::includeModule('im'))
	{
		return false;
	}

	if (!$code)
	{
		return false;
	}

	$botId = self::getNetworkBotId($code, true);
	if (!$botId)
	{
		return false;
	}

	$result = (bool)ImBot::unRegister(['BOT_ID' => $botId]);
	if (!$result)
	{
		return false;
	}

	self::setNetworkBotId($code, 0);

	if ($notifyController)
	{
		$result = (bool)self::sendUnregisterRequest($code, $botId);
	}

	(new DialogSession)->clearSessions(['BOT_ID' => $botId]);

	return $result;
}