CliRemote 1.7.10__py3-none-any.whl → 1.7.12__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {cliremote-1.7.10.dist-info → cliremote-1.7.12.dist-info}/METADATA +1 -1
- {cliremote-1.7.10.dist-info → cliremote-1.7.12.dist-info}/RECORD +6 -6
- remote/admin_manager.py +44 -58
- {cliremote-1.7.10.dist-info → cliremote-1.7.12.dist-info}/WHEEL +0 -0
- {cliremote-1.7.10.dist-info → cliremote-1.7.12.dist-info}/licenses/LICENSE +0 -0
- {cliremote-1.7.10.dist-info → cliremote-1.7.12.dist-info}/top_level.txt +0 -0
@@ -1,8 +1,8 @@
|
|
1
|
-
cliremote-1.7.
|
1
|
+
cliremote-1.7.12.dist-info/licenses/LICENSE,sha256=O-0zMbcEi6wXz1DiSdVgzMlQjJcNqNe5KDv08uYzqR0,1055
|
2
2
|
remote/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
3
3
|
remote/account_manager.py,sha256=TepnGIoE2hU-j_NmU5ByoS-JrboE0w3A1bYmQoQX5h8,15176
|
4
4
|
remote/account_viewer.py,sha256=j46KSjbgrBmBi7UxFeJ5tCwHIe0QvCvphkirGIbB2oo,5192
|
5
|
-
remote/admin_manager.py,sha256=
|
5
|
+
remote/admin_manager.py,sha256=WiUUVmSs5JTUdXeSry8PkK_3TRemAdSZjm0G1ilAA-A,3532
|
6
6
|
remote/analytics_manager.py,sha256=6jPvwt_ELA4RMbQdD8W_ltfAoaSgILnEkOAp6HZAqsU,7382
|
7
7
|
remote/batch_manager.py,sha256=jVGhYVwHMKJd7f7JxcWjKlwr03dq0RaGD1KdkyYdb00,1051
|
8
8
|
remote/block_manager.py,sha256=R7UaQigr-hTRtjxjG3OvJdKhvp0mDpLaESp3Of1AYhs,5692
|
@@ -33,7 +33,7 @@ remote/text_manager.py,sha256=C2wNSXPSCDu8NSD3RsfbKmUQMWOYd1B5N4tzy-Jsriw,2195
|
|
33
33
|
remote/username_manager.py,sha256=nMNdke-2FIv86xR1Y6rR-43oUoQu_3Khw8wEo54noXI,3388
|
34
34
|
remote/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
35
35
|
remote/utils/sqlite_utils.py,sha256=5i0oUXsBgKC_8qHZPJ-Gyhp9D1TwqKHVvuZRIhKpS6w,1260
|
36
|
-
cliremote-1.7.
|
37
|
-
cliremote-1.7.
|
38
|
-
cliremote-1.7.
|
39
|
-
cliremote-1.7.
|
36
|
+
cliremote-1.7.12.dist-info/METADATA,sha256=5veF0j81-22RdkS8kXAivQFqYCdzKf4uY8Io9WaZchc,1203
|
37
|
+
cliremote-1.7.12.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
38
|
+
cliremote-1.7.12.dist-info/top_level.txt,sha256=yBZidJ6zCix_a2ubGlYaewvlzBFXWbckQt20dudxJ1E,7
|
39
|
+
cliremote-1.7.12.dist-info/RECORD,,
|
remote/admin_manager.py
CHANGED
@@ -1,80 +1,67 @@
|
|
1
1
|
# remote/admin_manager.py
|
2
|
-
import json, os,
|
3
|
-
from pathlib import Path
|
2
|
+
import json, os, logging
|
4
3
|
from pyrogram import filters
|
5
4
|
from .config import OWNER_ID
|
6
5
|
|
7
6
|
logger = logging.getLogger(__name__)
|
8
7
|
|
9
|
-
|
10
|
-
"""
|
11
|
-
ریشه پروژه = پوشهای که main.py داخلش اجرا شده.
|
12
|
-
"""
|
13
|
-
try:
|
14
|
-
main_file = Path(sys.modules["__main__"].__file__).resolve()
|
15
|
-
return main_file.parent
|
16
|
-
except Exception:
|
17
|
-
# fallback: اگر به هر دلیل __main__.__file__ نبود
|
18
|
-
return Path(os.getcwd()).resolve()
|
8
|
+
ADMINS_FILE = "admins.json"
|
19
9
|
|
20
|
-
PROJECT_ROOT = _project_root()
|
21
|
-
ADMINS_FILE = PROJECT_ROOT / "admins.json" # ✅ کنار main.py
|
22
10
|
|
23
|
-
def
|
11
|
+
def load_admins() -> list[int]:
|
12
|
+
"""
|
13
|
+
بارگذاری لیست ادمینها از فایل.
|
14
|
+
همیشه OWNER_ID را هم به لیست اضافه میکند.
|
15
|
+
"""
|
16
|
+
s = set(OWNER_ID)
|
24
17
|
try:
|
25
|
-
if
|
26
|
-
with
|
18
|
+
if os.path.exists(ADMINS_FILE):
|
19
|
+
with open(ADMINS_FILE, "r", encoding="utf-8") as f:
|
27
20
|
data = json.load(f)
|
28
21
|
if isinstance(data, list):
|
29
|
-
out = []
|
30
22
|
for v in data:
|
31
23
|
try:
|
32
|
-
|
33
|
-
except
|
34
|
-
|
35
|
-
return out
|
24
|
+
s.add(int(v))
|
25
|
+
except:
|
26
|
+
pass
|
36
27
|
except Exception as e:
|
37
|
-
logger.warning(f"Error loading admins
|
38
|
-
return
|
39
|
-
|
40
|
-
# لیست ادمینهای موثر (فایل + Owner)
|
41
|
-
ADMINS: list[int] = []
|
28
|
+
logger.warning(f"Error loading admins: {e}")
|
29
|
+
return list(s)
|
42
30
|
|
43
|
-
def reload_admins():
|
44
|
-
"""فایل را میخواند و با OWNER_ID ادغام میکند؛ نتیجه در ADMINS."""
|
45
|
-
file_admins = _load_admins_from_file()
|
46
|
-
s = set(file_admins) | set(OWNER_ID)
|
47
|
-
global ADMINS
|
48
|
-
ADMINS = sorted(s)
|
49
|
-
logger.info(f"Loaded admins ({ADMINS_FILE}): {ADMINS}")
|
50
31
|
|
51
32
|
def save_admins():
|
52
33
|
"""
|
53
|
-
|
54
|
-
فقط ادمینهای غیر-Owner را داخل فایل نگه میداریم (Ownerها از config میآیند).
|
34
|
+
ذخیرهی ادمینها در فایل.
|
55
35
|
"""
|
56
36
|
try:
|
57
|
-
|
58
|
-
|
59
|
-
json.dump(file_list, f, ensure_ascii=False, indent=2)
|
60
|
-
logger.info(f"Saved admins to {ADMINS_FILE}: {file_list}")
|
37
|
+
with open(ADMINS_FILE, "w", encoding="utf-8") as f:
|
38
|
+
json.dump(list(ADMINS), f, ensure_ascii=False, indent=2)
|
61
39
|
except Exception as e:
|
62
40
|
logger.error(f"Error saving admins: {e}")
|
63
41
|
|
64
|
-
|
42
|
+
|
43
|
+
ADMINS = load_admins()
|
44
|
+
|
45
|
+
# فیلترهای دسترسی برای Pyrogram
|
65
46
|
admin_filter = filters.create(
|
66
|
-
lambda _, __, m: bool(getattr(m, "from_user", None))
|
47
|
+
lambda _, __, m: bool(getattr(m, "from_user", None))
|
48
|
+
and int(m.from_user.id) in ADMINS
|
67
49
|
)
|
68
50
|
owner_filter = filters.create(
|
69
|
-
lambda _, __, m: bool(getattr(m, "from_user", None))
|
51
|
+
lambda _, __, m: bool(getattr(m, "from_user", None))
|
52
|
+
and int(m.from_user.id) in OWNER_ID
|
70
53
|
)
|
71
54
|
|
72
|
-
|
55
|
+
|
56
|
+
# =============================
|
57
|
+
# فرمانهای مدیریتی
|
58
|
+
# =============================
|
59
|
+
|
73
60
|
async def add_admin_cmd(message):
|
74
61
|
try:
|
75
|
-
parts =
|
62
|
+
parts = message.text.split()
|
76
63
|
if len(parts) < 2:
|
77
|
-
await message.reply("مثال:
|
64
|
+
await message.reply("مثال: addadmin 123456789")
|
78
65
|
return
|
79
66
|
uid = int(parts[1])
|
80
67
|
if uid in OWNER_ID:
|
@@ -82,21 +69,20 @@ async def add_admin_cmd(message):
|
|
82
69
|
return
|
83
70
|
if uid not in ADMINS:
|
84
71
|
ADMINS.append(uid)
|
85
|
-
ADMINS[:] = sorted(set(ADMINS) | set(OWNER_ID))
|
86
72
|
save_admins()
|
87
|
-
await message.reply(f"ادمین جدید اضافه شد:
|
88
|
-
logger.info(f"Admin added: {uid}")
|
73
|
+
await message.reply(f"ادمین جدید اضافه شد: {uid}")
|
89
74
|
else:
|
90
75
|
await message.reply("قبلاً ادمین بود")
|
91
76
|
except Exception as e:
|
92
|
-
logger.error(f"add_admin_cmd error: {e}"
|
77
|
+
logger.error(f"add_admin_cmd error: {e}")
|
93
78
|
await message.reply(f"خطا: {e}")
|
94
79
|
|
80
|
+
|
95
81
|
async def del_admin_cmd(message):
|
96
82
|
try:
|
97
|
-
parts =
|
83
|
+
parts = message.text.split()
|
98
84
|
if len(parts) < 2:
|
99
|
-
await message.reply("مثال:
|
85
|
+
await message.reply("مثال: deladmin 123456789")
|
100
86
|
return
|
101
87
|
uid = int(parts[1])
|
102
88
|
if uid in OWNER_ID:
|
@@ -105,21 +91,21 @@ async def del_admin_cmd(message):
|
|
105
91
|
if uid in ADMINS:
|
106
92
|
ADMINS.remove(uid)
|
107
93
|
save_admins()
|
108
|
-
await message.reply(f"ادمین حذف شد:
|
109
|
-
logger.info(f"Admin removed: {uid}")
|
94
|
+
await message.reply(f"ادمین حذف شد: {uid}")
|
110
95
|
else:
|
111
96
|
await message.reply("کاربر ادمین نیست")
|
112
97
|
except Exception as e:
|
113
|
-
logger.error(f"del_admin_cmd error: {e}"
|
98
|
+
logger.error(f"del_admin_cmd error: {e}")
|
114
99
|
await message.reply(f"خطا: {e}")
|
115
100
|
|
101
|
+
|
116
102
|
async def list_admins_cmd(message):
|
117
103
|
try:
|
118
104
|
if not ADMINS:
|
119
105
|
await message.reply("لیست ادمینها خالی است.")
|
120
106
|
return
|
121
|
-
text = "👑 <b>ADMINS:</b>\n" + "\n".join([
|
122
|
-
await message.reply(text
|
107
|
+
text = "👑 <b>ADMINS:</b>\n" + "\n".join([str(x) for x in ADMINS])
|
108
|
+
await message.reply(text)
|
123
109
|
except Exception as e:
|
124
|
-
logger.error(f"list_admins_cmd error: {e}"
|
110
|
+
logger.error(f"list_admins_cmd error: {e}")
|
125
111
|
await message.reply(f"خطا: {e}")
|
File without changes
|
File without changes
|
File without changes
|