From ff426cd145bc827b2aad1b428942c462f118fd08 Mon Sep 17 00:00:00 2001 From: Houshmand <77535700+houshmand-2005@users.noreply.github.com> Date: Sat, 1 Jun 2024 22:10:12 +0330 Subject: [PATCH] use set --- utils/check_usage.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/utils/check_usage.py b/utils/check_usage.py index abc2fc4..f321288 100644 --- a/utils/check_usage.py +++ b/utils/check_usage.py @@ -55,12 +55,13 @@ async def check_users_usage(panel_data: PanelType): except_users = config_data.get("EXCEPT_USERS", []) special_limit = config_data.get("SPECIAL_LIMIT", {}) limit_number = config_data["GENERAL_LIMIT"] - for user_name, data in all_users_log.items(): + for user_name, user_ip in all_users_log.items(): if user_name not in except_users: user_limit_number = int(special_limit.get(user_name, limit_number)) - if len(data) > user_limit_number: + if len(set(user_ip)) > user_limit_number: message = ( - f"User {user_name} has {str(len(data))} active ips. {str(data)}" + f"User {user_name} has {str(len(set(user_ip)))}" + + f" active ips. {str(set(user_ip))}" ) logger.warning(message) await send_logs(str("Warning: " + message))