from dataclasses import dataclass import datetime from typing import Any from collections import deque @dataclass class AccountState: index: int client: Any phone: str status: str = "active" checks_this_hour: int = 0 cooldown_until: datetime.datetime = None at_risk: bool = False proxy: dict = None user_status: str = "Premium" last_used: Any = None profile_username: str = None # ⚡ NEW: Added for instant cache checks during live snipes # Global runtime state tracker state = { # System & Permissions "bot_start_time": None, "admin_ids": set(), "waiting_for_input": {}, "log_buffer": [], # Core Data Queues "account_pool": [], "check_queue": deque(), "snipe_queue": deque(), "watchdog_queue": set(), "fragcheck_queue": set(), "unavailable_set": set(), "active_alerts": {}, # Watchdog Meta "watch_submitters": {}, "watchdog_target_status": {}, "watchdog_last_checked": {}, "watchdog_attempts": {}, # Timers & Triggers "last_check_time": None, "next_check_time": None, "last_snipe_time": None, "next_snipe_time": None, "burst_in_progress": set(), "burst_last_triggered": None, # Scoreboards "total_checked": 0, "total_available": 0, "total_claimed": 0, "skipped_by_filter": 0, "start_checked_baseline": 0, # Dynamic Settings (Loaded from DB) "checking_active": False, "sniping_active": False, "cycle_paused": False, "autoclaim_on": True, "db_filter_on": True, "check_interval": 5, "snipe_interval": 5, "watchdog_poll_interval": 5, "mute_minor_alerts": False, "channel_claim_priority": "account_first", "preferred_channel_account": None, "custom_claim_message": "Secured", "fragment_sniping_active": False, "fragment_autoclaim_on": True, "fragment_workers": 40 }