CliRemote 1.7.7__py3-none-any.whl → 1.7.9__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.7.dist-info → cliremote-1.7.9.dist-info}/METADATA +1 -1
- {cliremote-1.7.7.dist-info → cliremote-1.7.9.dist-info}/RECORD +7 -7
- remote/account_viewer.py +34 -13
- remote/admin_manager.py +24 -32
- {cliremote-1.7.7.dist-info → cliremote-1.7.9.dist-info}/WHEEL +0 -0
- {cliremote-1.7.7.dist-info → cliremote-1.7.9.dist-info}/licenses/LICENSE +0 -0
- {cliremote-1.7.7.dist-info → cliremote-1.7.9.dist-info}/top_level.txt +0 -0
@@ -1,8 +1,8 @@
|
|
1
|
-
cliremote-1.7.
|
1
|
+
cliremote-1.7.9.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
|
-
remote/account_viewer.py,sha256=
|
5
|
-
remote/admin_manager.py,sha256=
|
4
|
+
remote/account_viewer.py,sha256=j46KSjbgrBmBi7UxFeJ5tCwHIe0QvCvphkirGIbB2oo,5192
|
5
|
+
remote/admin_manager.py,sha256=BxcLa8ZE5FPFRw8REl_RprIVR6Dtf1ZQrQAeZ8eOur4,4028
|
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.9.dist-info/METADATA,sha256=rfNCLxx2wNp7_wuPh65Zzhqcc3XPUXwifIVIpuoydZw,1202
|
37
|
+
cliremote-1.7.9.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
38
|
+
cliremote-1.7.9.dist-info/top_level.txt,sha256=yBZidJ6zCix_a2ubGlYaewvlzBFXWbckQt20dudxJ1E,7
|
39
|
+
cliremote-1.7.9.dist-info/RECORD,,
|
remote/account_viewer.py
CHANGED
@@ -1,19 +1,29 @@
|
|
1
|
-
#
|
2
|
-
import asyncio, logging
|
1
|
+
# CliRemote/remote/account_viewer.py
|
2
|
+
import asyncio, logging, os
|
3
3
|
from pyrogram import errors
|
4
4
|
from .client_manager import client_pool, get_or_start_client, accounts
|
5
5
|
|
6
6
|
logger = logging.getLogger(__name__)
|
7
7
|
|
8
|
+
ACCOUNT_LIST_PATH = os.path.join(os.getcwd(), "account_list.txt")
|
9
|
+
|
8
10
|
async def list_accounts_cmd(message):
|
9
11
|
"""
|
10
12
|
نمایش دقیق وضعیت اکانتها (با حفظ اتصالها)
|
11
|
-
|
13
|
+
خروجی نهایی همیشه در account_list.txt ذخیره میشود و در انتها فایل ارسال میگردد.
|
12
14
|
"""
|
13
15
|
try:
|
14
16
|
acc_list = accounts()
|
15
17
|
if not acc_list:
|
16
|
-
|
18
|
+
text = 'لیست اکانتها:\n(هیچ اکانتی وجود ندارد)'
|
19
|
+
# ذخیره در فایل
|
20
|
+
with open(ACCOUNT_LIST_PATH, "w", encoding="utf-8", newline="\n") as f:
|
21
|
+
f.write(text)
|
22
|
+
# ارسال فایل
|
23
|
+
await message.reply_document(
|
24
|
+
document=ACCOUNT_LIST_PATH,
|
25
|
+
caption="📋 گزارش اکانتها (خالی)"
|
26
|
+
)
|
17
27
|
return
|
18
28
|
|
19
29
|
lines = ['📋 <b>لیست اکانتها:</b>']
|
@@ -89,14 +99,25 @@ async def list_accounts_cmd(message):
|
|
89
99
|
|
90
100
|
text = "\n".join(lines)
|
91
101
|
|
92
|
-
# ✅
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
102
|
+
# ✅ همیشه ذخیره در فایل account_list.txt
|
103
|
+
with open(ACCOUNT_LIST_PATH, "w", encoding="utf-8", newline="\n") as f:
|
104
|
+
f.write(text)
|
105
|
+
|
106
|
+
# ✅ ارسال فایل خروجی
|
107
|
+
await message.reply_document(
|
108
|
+
document=ACCOUNT_LIST_PATH,
|
109
|
+
caption="📋 گزارش کامل اکانتها"
|
110
|
+
)
|
100
111
|
|
101
112
|
except Exception as e:
|
102
|
-
|
113
|
+
# اگر جایی خطا خورد، باز هم خطا را در فایل ذخیره و فایل را ارسال میکنیم
|
114
|
+
err_text = f'<b>خطا در نمایش لیست اکانتها:</b>\n{e}'
|
115
|
+
try:
|
116
|
+
with open(ACCOUNT_LIST_PATH, "w", encoding="utf-8", newline="\n") as f:
|
117
|
+
f.write(err_text)
|
118
|
+
await message.reply_document(
|
119
|
+
document=ACCOUNT_LIST_PATH,
|
120
|
+
caption="⚠️ خطا هنگام تهیه گزارش"
|
121
|
+
)
|
122
|
+
except Exception:
|
123
|
+
await message.reply(err_text)
|
remote/admin_manager.py
CHANGED
@@ -5,15 +5,15 @@ from .config import OWNER_ID
|
|
5
5
|
|
6
6
|
logger = logging.getLogger(__name__)
|
7
7
|
|
8
|
-
|
9
|
-
|
8
|
+
# فایل کنار همین ماژول ذخیره شود، نه نسبت به cwd
|
9
|
+
BASE_DIR = os.path.dirname(__file__)
|
10
|
+
ADMINS_FILE = os.path.join(BASE_DIR, "admins.json")
|
10
11
|
|
11
12
|
def load_admins() -> list[int]:
|
12
13
|
"""
|
13
|
-
بارگذاری لیست ادمینها از
|
14
|
-
همیشه OWNER_ID را هم به لیست اضافه میکند.
|
14
|
+
بارگذاری لیست ادمینها از فایل + اضافهکردن OWNER_ID
|
15
15
|
"""
|
16
|
-
s = set(OWNER_ID)
|
16
|
+
s = set(OWNER_ID) # همیشه Ownerها باشند
|
17
17
|
try:
|
18
18
|
if os.path.exists(ADMINS_FILE):
|
19
19
|
with open(ADMINS_FILE, "r", encoding="utf-8") as f:
|
@@ -22,46 +22,38 @@ def load_admins() -> list[int]:
|
|
22
22
|
for v in data:
|
23
23
|
try:
|
24
24
|
s.add(int(v))
|
25
|
-
except:
|
26
|
-
|
25
|
+
except Exception:
|
26
|
+
logger.warning(f"Bad admin id in file: {v!r}")
|
27
27
|
except Exception as e:
|
28
28
|
logger.warning(f"Error loading admins: {e}")
|
29
29
|
return list(s)
|
30
30
|
|
31
|
-
|
32
31
|
def save_admins():
|
33
|
-
"""
|
34
|
-
ذخیرهی ادمینها در فایل.
|
35
|
-
"""
|
32
|
+
"""ذخیرهی ادمینها در فایل (بدون Ownerها، فقط ADMINS پویا)."""
|
36
33
|
try:
|
37
34
|
with open(ADMINS_FILE, "w", encoding="utf-8") as f:
|
38
35
|
json.dump(list(ADMINS), f, ensure_ascii=False, indent=2)
|
39
36
|
except Exception as e:
|
40
37
|
logger.error(f"Error saving admins: {e}")
|
41
38
|
|
42
|
-
|
43
39
|
ADMINS = load_admins()
|
44
40
|
|
45
|
-
#
|
41
|
+
# فیلترها (داینامیک: هر بار اجرا، مقدار فعلی لیستها چک میشود)
|
46
42
|
admin_filter = filters.create(
|
47
|
-
lambda _, __, m: bool(getattr(m, "from_user", None))
|
48
|
-
and int(m.from_user.id) in ADMINS
|
43
|
+
lambda _, __, m: bool(getattr(m, "from_user", None)) and int(m.from_user.id) in ADMINS
|
49
44
|
)
|
50
45
|
owner_filter = filters.create(
|
51
|
-
lambda _, __, m: bool(getattr(m, "from_user", None))
|
52
|
-
and int(m.from_user.id) in OWNER_ID
|
46
|
+
lambda _, __, m: bool(getattr(m, "from_user", None)) and int(m.from_user.id) in OWNER_ID
|
53
47
|
)
|
54
48
|
|
55
|
-
|
56
49
|
# =============================
|
57
50
|
# فرمانهای مدیریتی
|
58
51
|
# =============================
|
59
|
-
|
60
52
|
async def add_admin_cmd(message):
|
61
53
|
try:
|
62
|
-
parts = message.text.split()
|
54
|
+
parts = (message.text or "").split()
|
63
55
|
if len(parts) < 2:
|
64
|
-
await message.reply("مثال: addadmin 123456789")
|
56
|
+
await message.reply("مثال: /addadmin 123456789")
|
65
57
|
return
|
66
58
|
uid = int(parts[1])
|
67
59
|
if uid in OWNER_ID:
|
@@ -70,19 +62,19 @@ async def add_admin_cmd(message):
|
|
70
62
|
if uid not in ADMINS:
|
71
63
|
ADMINS.append(uid)
|
72
64
|
save_admins()
|
73
|
-
await message.reply(f"ادمین جدید اضافه شد: {uid}")
|
65
|
+
await message.reply(f"ادمین جدید اضافه شد: <code>{uid}</code>")
|
66
|
+
logger.info(f"Admin added: {uid}")
|
74
67
|
else:
|
75
68
|
await message.reply("قبلاً ادمین بود")
|
76
69
|
except Exception as e:
|
77
|
-
logger.error(f"add_admin_cmd error: {e}")
|
70
|
+
logger.error(f"add_admin_cmd error: {e}", exc_info=True)
|
78
71
|
await message.reply(f"خطا: {e}")
|
79
72
|
|
80
|
-
|
81
73
|
async def del_admin_cmd(message):
|
82
74
|
try:
|
83
|
-
parts = message.text.split()
|
75
|
+
parts = (message.text or "").split()
|
84
76
|
if len(parts) < 2:
|
85
|
-
await message.reply("مثال: deladmin 123456789")
|
77
|
+
await message.reply("مثال: /deladmin 123456789")
|
86
78
|
return
|
87
79
|
uid = int(parts[1])
|
88
80
|
if uid in OWNER_ID:
|
@@ -91,21 +83,21 @@ async def del_admin_cmd(message):
|
|
91
83
|
if uid in ADMINS:
|
92
84
|
ADMINS.remove(uid)
|
93
85
|
save_admins()
|
94
|
-
await message.reply(f"ادمین حذف شد: {uid}")
|
86
|
+
await message.reply(f"ادمین حذف شد: <code>{uid}</code>")
|
87
|
+
logger.info(f"Admin removed: {uid}")
|
95
88
|
else:
|
96
89
|
await message.reply("کاربر ادمین نیست")
|
97
90
|
except Exception as e:
|
98
|
-
logger.error(f"del_admin_cmd error: {e}")
|
91
|
+
logger.error(f"del_admin_cmd error: {e}", exc_info=True)
|
99
92
|
await message.reply(f"خطا: {e}")
|
100
93
|
|
101
|
-
|
102
94
|
async def list_admins_cmd(message):
|
103
95
|
try:
|
104
96
|
if not ADMINS:
|
105
97
|
await message.reply("لیست ادمینها خالی است.")
|
106
98
|
return
|
107
|
-
text = "👑 <b>ADMINS:</b>\n" + "\n".join([
|
108
|
-
await message.reply(text)
|
99
|
+
text = "👑 <b>ADMINS:</b>\n" + "\n".join([f"<code>{x}</code>" for x in ADMINS])
|
100
|
+
await message.reply(text, disable_web_page_preview=True)
|
109
101
|
except Exception as e:
|
110
|
-
logger.error(f"list_admins_cmd error: {e}")
|
102
|
+
logger.error(f"list_admins_cmd error: {e}", exc_info=True)
|
111
103
|
await message.reply(f"خطا: {e}")
|
File without changes
|
File without changes
|
File without changes
|