• Модуль: imbot
  • Путь к файлу: ~/bitrix/modules/imbot/lib/bot/supportbox.php
  • Класс: BitrixImBotBotSupportBox
  • Вызов: SupportBox::getPreviousBotId
static function getPreviousBotId(): ?int
{
	$botId = (int)parent::getNetworkBotId(self::getPreviousBotCode(), true);
	if ($botId > 0)
	{
		$botData = ImBot::getCache($botId);
		if ($botData['CLASS'] != 'Bitrix\ImBot\Bot\Support')
		{
			$botId = -1;
		}
	}
	else
	{
		$res = ImModelBotTable::getList([
			'select' => ['BOT_ID'],
			'filter' => [
				'=CLASS' => 'Bitrix\ImBot\Bot\Support'
			]
		]);
		if ($botData = $res->fetch())
		{
			$botId = (int)$botData['BOT_ID'];
		}
	}

	return $botId > 0 ? $botId : null;
}