• Модуль: imbot
  • Путь к файлу: ~/bitrix/modules/imbot/lib/bot/support24.php
  • Класс: BitrixImBotBotSupport24
  • Вызов: Support24::getBotSettings
static function getBotSettings(array $params = []): ?array
{
	static $result;
	if (empty($result))
	{
		if (MainLoader::includeModule('bitrix24'))
		{
			if (CBitrix24::isDemoLicense())
			{
				$params['PORTAL_TARIFF'] = CBitrix24::getLicenseType(CBitrix24::LICENSE_TYPE_PREVIOUS);
			}
			else
			{
				$params['PORTAL_TARIFF'] = CBitrix24::getLicenseType(CBitrix24::LICENSE_TYPE_CURRENT);
			}
		}

		$settings = parent::getBotSettings($params);
		if (empty($settings))
		{
			return null;
		}

		$result = [];
		$mirrors = [
			self::OPTION_BOT_FREE_CODE => 'support24_free_code',
			self::OPTION_BOT_FREE_NAME => 'support24_free_name',
			self::OPTION_BOT_FREE_DESC => 'support24_free_desc',
			self::OPTION_BOT_FREE_DAYS => 'support24_free_days',
			self::OPTION_BOT_FREE_AVATAR => 'support24_free_avatar',
			self::OPTION_BOT_FREE_FOR_ALL => 'support24_free_for_all',
			self::OPTION_BOT_FREE_MESSAGES => 'support24_free_messages',
			self::OPTION_BOT_PAID_CODE => 'support24_paid_code',
			self::OPTION_BOT_PAID_NAME => 'support24_paid_name',
			self::OPTION_BOT_PAID_DESC => 'support24_paid_desc',
			self::OPTION_BOT_PAID_AVATAR => 'support24_paid_avatar',
			self::OPTION_BOT_PAID_FOR_ALL => 'support24_paid_for_all',
			self::OPTION_BOT_PAID_MESSAGES => 'support24_paid_messages',
			self::OPTION_BOT_FREE_MENU => 'support24_free_menu',
			self::OPTION_BOT_PAID_MENU => 'support24_paid_menu',
			self::OPTION_BOT_FREE_MENU_STAGE => 'support24_free_menu_stage',
			self::OPTION_BOT_PAID_MENU_STAGE => 'support24_paid_menu_stage',
			self::OPTION_BOT_PAID_ACTIVE => 'support24_paid_active',
			MixinOPTION_BOT_QUESTION_LIMIT => 'support24_session_limit',
		];
		foreach ($mirrors as $prop => $alias)
		{
			if (isset($settings[$alias]))
			{
				$result[$prop] = $settings[$alias];
			}
		}
	}

	return $result;
}