use once_cell::sync::Lazy; use std::collections::{HashMap, HashSet}; use std::sync::RwLock; static SEEN_USERS: Lazy>>> = Lazy::new(|| RwLock::new(HashMap::new())); pub fn track_user(chat_id: i64, username: String) { let mut map = SEEN_USERS.write().unwrap(); map.entry(chat_id).or_default().insert(username); } pub fn get_tracked_users(chat_id: i64) -> Vec { SEEN_USERS .read() .unwrap() .get(&chat_id) .map(|s| s.iter().cloned().collect()) .unwrap_or_default() }