CliRemote 1.7.0__tar.gz → 1.7.1__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.
- {cliremote-1.7.0 → cliremote-1.7.1}/CliRemote.egg-info/PKG-INFO +1 -1
- {cliremote-1.7.0 → cliremote-1.7.1}/PKG-INFO +1 -1
- {cliremote-1.7.0 → cliremote-1.7.1}/pyproject.toml +1 -1
- {cliremote-1.7.0 → cliremote-1.7.1}/remote/account_manager.py +147 -0
- {cliremote-1.7.0 → cliremote-1.7.1}/setup.py +1 -1
- {cliremote-1.7.0 → cliremote-1.7.1}/CliRemote.egg-info/SOURCES.txt +0 -0
- {cliremote-1.7.0 → cliremote-1.7.1}/CliRemote.egg-info/dependency_links.txt +0 -0
- {cliremote-1.7.0 → cliremote-1.7.1}/CliRemote.egg-info/requires.txt +0 -0
- {cliremote-1.7.0 → cliremote-1.7.1}/CliRemote.egg-info/top_level.txt +0 -0
- {cliremote-1.7.0 → cliremote-1.7.1}/LICENSE +0 -0
- {cliremote-1.7.0 → cliremote-1.7.1}/MANIFEST.in +0 -0
- {cliremote-1.7.0 → cliremote-1.7.1}/README.md +0 -0
- {cliremote-1.7.0 → cliremote-1.7.1}/remote/__init__.py +0 -0
- {cliremote-1.7.0 → cliremote-1.7.1}/remote/account_viewer.py +0 -0
- {cliremote-1.7.0 → cliremote-1.7.1}/remote/admin_manager.py +0 -0
- {cliremote-1.7.0 → cliremote-1.7.1}/remote/analytics_manager.py +0 -0
- {cliremote-1.7.0 → cliremote-1.7.1}/remote/batch_manager.py +0 -0
- {cliremote-1.7.0 → cliremote-1.7.1}/remote/block_manager.py +0 -0
- {cliremote-1.7.0 → cliremote-1.7.1}/remote/caption_manager.py +0 -0
- {cliremote-1.7.0 → cliremote-1.7.1}/remote/cleaner.py +0 -0
- {cliremote-1.7.0 → cliremote-1.7.1}/remote/client_manager.py +0 -0
- {cliremote-1.7.0 → cliremote-1.7.1}/remote/client_picker.py +0 -0
- {cliremote-1.7.0 → cliremote-1.7.1}/remote/config.py +0 -0
- {cliremote-1.7.0 → cliremote-1.7.1}/remote/device_manager.py +0 -0
- {cliremote-1.7.0 → cliremote-1.7.1}/remote/file_sender.py +0 -0
- {cliremote-1.7.0 → cliremote-1.7.1}/remote/getcode_controller.py +0 -0
- {cliremote-1.7.0 → cliremote-1.7.1}/remote/health.py +0 -0
- {cliremote-1.7.0 → cliremote-1.7.1}/remote/help_menu.py +0 -0
- {cliremote-1.7.0 → cliremote-1.7.1}/remote/init.py +0 -0
- {cliremote-1.7.0 → cliremote-1.7.1}/remote/join_controller.py +0 -0
- {cliremote-1.7.0 → cliremote-1.7.1}/remote/joiner.py +0 -0
- {cliremote-1.7.0 → cliremote-1.7.1}/remote/leave_controller.py +0 -0
- {cliremote-1.7.0 → cliremote-1.7.1}/remote/lefter.py +0 -0
- {cliremote-1.7.0 → cliremote-1.7.1}/remote/mention_manager.py +0 -0
- {cliremote-1.7.0 → cliremote-1.7.1}/remote/precise_engine.py +0 -0
- {cliremote-1.7.0 → cliremote-1.7.1}/remote/profile_info.py +0 -0
- {cliremote-1.7.0 → cliremote-1.7.1}/remote/profile_media.py +0 -0
- {cliremote-1.7.0 → cliremote-1.7.1}/remote/profile_privacy.py +0 -0
- {cliremote-1.7.0 → cliremote-1.7.1}/remote/spammer.py +0 -0
- {cliremote-1.7.0 → cliremote-1.7.1}/remote/speed_manager.py +0 -0
- {cliremote-1.7.0 → cliremote-1.7.1}/remote/stop_manager.py +0 -0
- {cliremote-1.7.0 → cliremote-1.7.1}/remote/text_manager.py +0 -0
- {cliremote-1.7.0 → cliremote-1.7.1}/remote/username_manager.py +0 -0
- {cliremote-1.7.0 → cliremote-1.7.1}/remote/utils/__init__.py +0 -0
- {cliremote-1.7.0 → cliremote-1.7.1}/remote/utils/sqlite_utils.py +0 -0
- {cliremote-1.7.0 → cliremote-1.7.1}/setup.cfg +0 -0
@@ -244,3 +244,150 @@ def accounts() -> List[str]:
|
|
244
244
|
|
245
245
|
def get_active_accounts() -> Set[str]:
|
246
246
|
return set(accounts())
|
247
|
+
|
248
|
+
# ============================================================
|
249
|
+
# 🗑️ حذف اکانت
|
250
|
+
# ============================================================
|
251
|
+
async def delete_account_cmd(message) -> None:
|
252
|
+
"""
|
253
|
+
حذف اکانت مشخص شده
|
254
|
+
دستور: /del <phone_number>
|
255
|
+
"""
|
256
|
+
try:
|
257
|
+
# استخراج شماره تلفن از پیام
|
258
|
+
command_parts = message.text.split()
|
259
|
+
if len(command_parts) < 2:
|
260
|
+
await message.reply_text("⚠️ لطفاً شماره تلفن اکانت را وارد کنید:\n`/del 989123456789`")
|
261
|
+
return
|
262
|
+
|
263
|
+
phone_number = command_parts[1].strip()
|
264
|
+
|
265
|
+
# بررسی وجود اکانت
|
266
|
+
if phone_number not in get_active_accounts():
|
267
|
+
await message.reply_text(f"❌ اکانت `{phone_number}` یافت نشد.")
|
268
|
+
return
|
269
|
+
|
270
|
+
# توقف کلاینت اگر در حال اجراست
|
271
|
+
if phone_number in client_pool:
|
272
|
+
try:
|
273
|
+
cli = client_pool[phone_number]
|
274
|
+
if getattr(cli, "is_connected", False):
|
275
|
+
await cli.stop()
|
276
|
+
client_pool.pop(phone_number, None)
|
277
|
+
client_locks.pop(phone_number, None)
|
278
|
+
logger.info(f"{phone_number}: 📴 Client stopped for deletion.")
|
279
|
+
except Exception as e:
|
280
|
+
logger.warning(f"{phone_number}: ⚠️ Error stopping client before deletion - {e}")
|
281
|
+
|
282
|
+
# حذف فایلهای session
|
283
|
+
session_deleted = False
|
284
|
+
data_deleted = False
|
285
|
+
|
286
|
+
session_files = [
|
287
|
+
os.path.join(ACCOUNTS_FOLDER, f"{phone_number}.session"),
|
288
|
+
os.path.join(ACCOUNTS_FOLDER, phone_number), # برای حالتهای مختلف نام session
|
289
|
+
f"{phone_number}.session", # در صورت وجود در مسیر جاری
|
290
|
+
]
|
291
|
+
|
292
|
+
for session_file in session_files:
|
293
|
+
if os.path.exists(session_file):
|
294
|
+
try:
|
295
|
+
os.remove(session_file)
|
296
|
+
session_deleted = True
|
297
|
+
logger.info(f"{phone_number}: 🗑️ Session file deleted → {session_file}")
|
298
|
+
except Exception as e:
|
299
|
+
logger.error(f"{phone_number}: ⚠️ Error deleting session file {session_file} - {e}")
|
300
|
+
|
301
|
+
# حذف فایل دادههای اکانت
|
302
|
+
data_file = os.path.join(ACCOUNTS_DATA_FOLDER, f"{phone_number}.json")
|
303
|
+
if os.path.exists(data_file):
|
304
|
+
try:
|
305
|
+
os.remove(data_file)
|
306
|
+
data_deleted = True
|
307
|
+
logger.info(f"{phone_number}: 🗑️ Account data deleted → {data_file}")
|
308
|
+
except Exception as e:
|
309
|
+
logger.error(f"{phone_number}: ⚠️ Error deleting account data {data_file} - {e}")
|
310
|
+
|
311
|
+
# ارسال نتیجه به کاربر
|
312
|
+
if session_deleted or data_deleted:
|
313
|
+
await message.reply_text(f"✅ اکانت `{phone_number}` با موفقیت حذف شد.\n"
|
314
|
+
f"• فایل session: {'✅' if session_deleted else '❌'}\n"
|
315
|
+
f"• فایل داده: {'✅' if data_deleted else '❌'}")
|
316
|
+
logger.info(f"{phone_number}: ✅ Account deletion completed.")
|
317
|
+
else:
|
318
|
+
await message.reply_text(f"⚠️ هیچ فایلی برای اکانت `{phone_number}` یافت نشد.")
|
319
|
+
|
320
|
+
except Exception as e:
|
321
|
+
error_msg = f"💥 خطا در حذف اکانت: {str(e)}"
|
322
|
+
logger.error(f"delete_account_cmd error: {traceback.format_exc()}")
|
323
|
+
await message.reply_text(error_msg)
|
324
|
+
|
325
|
+
|
326
|
+
# ============================================================
|
327
|
+
# 🗑️ حذف تمامی اکانتها
|
328
|
+
# ============================================================
|
329
|
+
async def delete_all_accounts_cmd(message) -> None:
|
330
|
+
"""
|
331
|
+
حذف تمامی اکانتها
|
332
|
+
دستور: /delall
|
333
|
+
"""
|
334
|
+
try:
|
335
|
+
# گرفتن تایید از کاربر
|
336
|
+
confirm_text = "⚠️ **آیا مطمئن هستید که میخواهید تمامی اکانتها را حذف کنید؟**\n\n"
|
337
|
+
confirm_text += "این عمل غیرقابل بازگشت است!\n"
|
338
|
+
confirm_text += "برای تایید، دستور زیر را ارسال کنید:\n`/delall confirm`"
|
339
|
+
|
340
|
+
command_parts = message.text.split()
|
341
|
+
if len(command_parts) < 2 or command_parts[1].strip().lower() != "confirm":
|
342
|
+
await message.reply_text(confirm_text)
|
343
|
+
return
|
344
|
+
|
345
|
+
# توقف تمام کلاینتها
|
346
|
+
await stop_all_clients()
|
347
|
+
|
348
|
+
# لیست تمام اکانتها
|
349
|
+
all_accounts = get_active_accounts()
|
350
|
+
deleted_sessions = 0
|
351
|
+
deleted_data_files = 0
|
352
|
+
|
353
|
+
# حذف تمام فایلهای session
|
354
|
+
if os.path.exists(ACCOUNTS_FOLDER):
|
355
|
+
for filename in os.listdir(ACCOUNTS_FOLDER):
|
356
|
+
if filename.endswith('.session'):
|
357
|
+
try:
|
358
|
+
file_path = os.path.join(ACCOUNTS_FOLDER, filename)
|
359
|
+
os.remove(file_path)
|
360
|
+
deleted_sessions += 1
|
361
|
+
logger.info(f"🗑️ Session file deleted → {filename}")
|
362
|
+
except Exception as e:
|
363
|
+
logger.error(f"⚠️ Error deleting session file {filename} - {e}")
|
364
|
+
|
365
|
+
# حذف تمام فایلهای داده
|
366
|
+
if os.path.exists(ACCOUNTS_DATA_FOLDER):
|
367
|
+
for filename in os.listdir(ACCOUNTS_DATA_FOLDER):
|
368
|
+
if filename.endswith('.json'):
|
369
|
+
try:
|
370
|
+
file_path = os.path.join(ACCOUNTS_DATA_FOLDER, filename)
|
371
|
+
os.remove(file_path)
|
372
|
+
deleted_data_files += 1
|
373
|
+
logger.info(f"🗑️ Account data deleted → {filename}")
|
374
|
+
except Exception as e:
|
375
|
+
logger.error(f"⚠️ Error deleting account data {filename} - {e}")
|
376
|
+
|
377
|
+
# پاک کردن کش داخلی
|
378
|
+
client_pool.clear()
|
379
|
+
client_locks.clear()
|
380
|
+
|
381
|
+
# ارسال نتیجه به کاربر
|
382
|
+
result_msg = (f"✅ **حذف کامل اکانتها انجام شد**\n\n"
|
383
|
+
f"• تعداد فایلهای session حذف شده: `{deleted_sessions}`\n"
|
384
|
+
f"• تعداد فایلهای داده حذف شده: `{deleted_data_files}`\n"
|
385
|
+
f"• تعداد اکانتهای شناسایی شده: `{len(all_accounts)}`")
|
386
|
+
|
387
|
+
await message.reply_text(result_msg)
|
388
|
+
logger.info(f"🎯 All accounts deletion completed: {deleted_sessions} sessions, {deleted_data_files} data files")
|
389
|
+
|
390
|
+
except Exception as e:
|
391
|
+
error_msg = f"💥 خطا در حذف کامل اکانتها: {str(e)}"
|
392
|
+
logger.error(f"delete_all_accounts_cmd error: {traceback.format_exc()}")
|
393
|
+
await message.reply_text(error_msg)
|
@@ -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.
|
8
|
+
version="1.7.1",
|
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
|
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
|
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
|
File without changes
|
File without changes
|