• Модуль: imbot
  • Путь к файлу: ~/bitrix/modules/imbot/lib/bot/support24.php
  • Класс: BitrixImBotBotSupport24
  • Вызов: Support24::getBotMenu
static function getBotMenu(): ?ItrMenu
{
	static $hasMenu;
	if ($hasMenu === null)
	{
		$hasMenu = false;

		if (self::isStagePortal())
		{
			if (self::getSupportLevel() == self::SUPPORT_LEVEL_FREE)
			{
				$menuType = self::OPTION_BOT_FREE_MENU_STAGE;
			}
			else
			{
				$menuType = self::OPTION_BOT_PAID_MENU_STAGE;
			}
		}
		elseif (self::getSupportLevel() == self::SUPPORT_LEVEL_FREE)
		{
			$menuType = self::OPTION_BOT_FREE_MENU;
		}
		else
		{
			$menuType = self::OPTION_BOT_PAID_MENU;
		}

		$json = Option::get(self::MODULE_ID, $menuType, '');
		if ($json)
		{
			try
			{
				$structure = MainWebJson::decode($json);
				self::instanceMenu()->setStructure($structure);
				$hasMenu = true;
			}
			catch (MainArgumentException $e)
			{
			}
		}
	}

	return $hasMenu ? self::instanceMenu() : null;
}