CliRemote 1.7.7__tar.gz → 1.7.9__tar.gz

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.
Files changed (46) hide show
  1. {cliremote-1.7.7 → cliremote-1.7.9}/CliRemote.egg-info/PKG-INFO +1 -1
  2. {cliremote-1.7.7 → cliremote-1.7.9}/PKG-INFO +1 -1
  3. {cliremote-1.7.7 → cliremote-1.7.9}/pyproject.toml +1 -1
  4. {cliremote-1.7.7 → cliremote-1.7.9}/remote/account_viewer.py +34 -13
  5. {cliremote-1.7.7 → cliremote-1.7.9}/remote/admin_manager.py +24 -32
  6. {cliremote-1.7.7 → cliremote-1.7.9}/setup.py +1 -1
  7. {cliremote-1.7.7 → cliremote-1.7.9}/CliRemote.egg-info/SOURCES.txt +0 -0
  8. {cliremote-1.7.7 → cliremote-1.7.9}/CliRemote.egg-info/dependency_links.txt +0 -0
  9. {cliremote-1.7.7 → cliremote-1.7.9}/CliRemote.egg-info/requires.txt +0 -0
  10. {cliremote-1.7.7 → cliremote-1.7.9}/CliRemote.egg-info/top_level.txt +0 -0
  11. {cliremote-1.7.7 → cliremote-1.7.9}/LICENSE +0 -0
  12. {cliremote-1.7.7 → cliremote-1.7.9}/MANIFEST.in +0 -0
  13. {cliremote-1.7.7 → cliremote-1.7.9}/README.md +0 -0
  14. {cliremote-1.7.7 → cliremote-1.7.9}/remote/__init__.py +0 -0
  15. {cliremote-1.7.7 → cliremote-1.7.9}/remote/account_manager.py +0 -0
  16. {cliremote-1.7.7 → cliremote-1.7.9}/remote/analytics_manager.py +0 -0
  17. {cliremote-1.7.7 → cliremote-1.7.9}/remote/batch_manager.py +0 -0
  18. {cliremote-1.7.7 → cliremote-1.7.9}/remote/block_manager.py +0 -0
  19. {cliremote-1.7.7 → cliremote-1.7.9}/remote/caption_manager.py +0 -0
  20. {cliremote-1.7.7 → cliremote-1.7.9}/remote/cleaner.py +0 -0
  21. {cliremote-1.7.7 → cliremote-1.7.9}/remote/client_manager.py +0 -0
  22. {cliremote-1.7.7 → cliremote-1.7.9}/remote/client_picker.py +0 -0
  23. {cliremote-1.7.7 → cliremote-1.7.9}/remote/config.py +0 -0
  24. {cliremote-1.7.7 → cliremote-1.7.9}/remote/device_manager.py +0 -0
  25. {cliremote-1.7.7 → cliremote-1.7.9}/remote/file_sender.py +0 -0
  26. {cliremote-1.7.7 → cliremote-1.7.9}/remote/getcode_controller.py +0 -0
  27. {cliremote-1.7.7 → cliremote-1.7.9}/remote/health.py +0 -0
  28. {cliremote-1.7.7 → cliremote-1.7.9}/remote/help_menu.py +0 -0
  29. {cliremote-1.7.7 → cliremote-1.7.9}/remote/init.py +0 -0
  30. {cliremote-1.7.7 → cliremote-1.7.9}/remote/join_controller.py +0 -0
  31. {cliremote-1.7.7 → cliremote-1.7.9}/remote/joiner.py +0 -0
  32. {cliremote-1.7.7 → cliremote-1.7.9}/remote/leave_controller.py +0 -0
  33. {cliremote-1.7.7 → cliremote-1.7.9}/remote/lefter.py +0 -0
  34. {cliremote-1.7.7 → cliremote-1.7.9}/remote/mention_manager.py +0 -0
  35. {cliremote-1.7.7 → cliremote-1.7.9}/remote/precise_engine.py +0 -0
  36. {cliremote-1.7.7 → cliremote-1.7.9}/remote/profile_info.py +0 -0
  37. {cliremote-1.7.7 → cliremote-1.7.9}/remote/profile_media.py +0 -0
  38. {cliremote-1.7.7 → cliremote-1.7.9}/remote/profile_privacy.py +0 -0
  39. {cliremote-1.7.7 → cliremote-1.7.9}/remote/spammer.py +0 -0
  40. {cliremote-1.7.7 → cliremote-1.7.9}/remote/speed_manager.py +0 -0
  41. {cliremote-1.7.7 → cliremote-1.7.9}/remote/stop_manager.py +0 -0
  42. {cliremote-1.7.7 → cliremote-1.7.9}/remote/text_manager.py +0 -0
  43. {cliremote-1.7.7 → cliremote-1.7.9}/remote/username_manager.py +0 -0
  44. {cliremote-1.7.7 → cliremote-1.7.9}/remote/utils/__init__.py +0 -0
  45. {cliremote-1.7.7 → cliremote-1.7.9}/remote/utils/sqlite_utils.py +0 -0
  46. {cliremote-1.7.7 → cliremote-1.7.9}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: CliRemote
3
- Version: 1.7.7
3
+ Version: 1.7.9
4
4
  Summary: Remote client framework for Telegram automation using Pyrogram
5
5
  Home-page: https://github.com/MohammadAhmadi-R/CliRemote
6
6
  Author: MrAhmadiRad
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: CliRemote
3
- Version: 1.7.7
3
+ Version: 1.7.9
4
4
  Summary: Remote client framework for Telegram automation using Pyrogram
5
5
  Home-page: https://github.com/MohammadAhmadi-R/CliRemote
6
6
  Author: MrAhmadiRad
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "CliRemote"
7
- version = "1.7.7"
7
+ version = "1.7.9"
8
8
  description = "Remote client framework for Telegram automation using Pyrogram"
9
9
  readme = "README.md"
10
10
  license = {text = "MIT"}
@@ -1,19 +1,29 @@
1
- # antispam_core/account_viewer.py
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
- از client_pool برای بررسی فعال بودن استفاده می‌کند.
13
+ خروجی نهایی همیشه در account_list.txt ذخیره می‌شود و در انتها فایل ارسال می‌گردد.
12
14
  """
13
15
  try:
14
16
  acc_list = accounts()
15
17
  if not acc_list:
16
- await message.reply('لیست اکانت‌ها:\n(هیچ اکانتی وجود ندارد)')
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
- if len(text) > 3900:
94
- await message.reply_document(
95
- document=("accounts_report.txt", text.encode('utf-8')),
96
- caption="📋 گزارش کامل اکانت‌ها"
97
- )
98
- else:
99
- await message.reply(text, disable_web_page_preview=True)
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
- await message.reply(f'<b>خطا در نمایش لیست اکانت‌ها:</b>\n{e}')
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)
@@ -5,15 +5,15 @@ from .config import OWNER_ID
5
5
 
6
6
  logger = logging.getLogger(__name__)
7
7
 
8
- ADMINS_FILE = "admins.json"
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
- pass
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
- # فیلترهای دسترسی برای Pyrogram
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([str(x) for x in ADMINS])
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}")
@@ -5,7 +5,7 @@ with open("README.md", encoding="utf-8") as f:
5
5
 
6
6
  setup(
7
7
  name="CliRemote",
8
- version="1.7.7",
8
+ version="1.7.9",
9
9
  author="MrAhmadiRad",
10
10
  author_email="mohammadahmadirad69@gmail.com",
11
11
  description="A precise, async-safe, Telegram automation core (Python 3.8+)",
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes