#!/usr/bin/env python3 # -*- coding: utf-8 -*- ####################################################### # PRIVATE LICENSE NOTICE # # © 2025 AKN-DEV. All Rights Reserved. # # # # This software is licensed under PRIVATE LICENSE. # # Unauthorized use, modification, distribution, # # or replication is strictly prohibited. # # # # LEGAL OWNER: AKN-DEV TEAM # # CONTACT: @aknuserbot (Telegram) # # # # VIOLATIONS WILL RESULT IN: # # - Automatic bot termination # # - Legal action under DMCA/EU Copyright Law # # - Permanent blacklist from all products # ####################################################### import json from pathlib import Path from packaging import version from akn.utils.logger import LOGS import importlib.metadata import platform def get_version_from_file() -> str: try: with open(Path(__file__).parent.parent / "version.json") as f: return json.load(f)["version"] except Exception as e: LOGS.critical(f"Version check failed: {str(e)}") raise RuntimeError("Could not determine bot version") from e def validate_version(bot_name: str) -> bool: try: version_file_path = Path(__file__).parent.parent / "version.json" with open(version_file_path) as f: version_data = json.load(f) except Exception as e: raise RuntimeError(f"Failed to load version.json: {str(e)}") current_py = platform.python_version() if version.parse(current_py) < version.parse(version_data["min_python"]): raise RuntimeError( f"Python {version_data['min_python']}+ required (found {current_py})" ) bot_requirements = version_data.get("multiple_bot", {}) if bot_name not in bot_requirements: return False, f"Bot '{bot_name}' not in version configuration" required_ver = bot_requirements[bot_name] current_ver = version_data["version"] if not version.parse(current_ver) >= version.parse(required_ver.lstrip(">=")): return False, f"Requires {required_ver} (current: {current_ver})" try: pyro_ver = importlib.metadata.version("kurigram") if version.parse(pyro_ver) < version.parse("2.1.30"): LOGS.warning(f"Old Pyrogram version: {pyro_ver}") except ImportError: pass return True, "Version OK" ####################################################### # DO NOT REMOVE THIS LICENSE NOTICE! # # This code contains proprietary trade secrets of # # AKN-DEV. Any removal will result in legal action. # #######################################################