CliRemote 1.7.3__py3-none-any.whl → 1.7.5__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: CliRemote
3
- Version: 1.7.3
3
+ Version: 1.7.5
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,4 +1,4 @@
1
- cliremote-1.7.3.dist-info/licenses/LICENSE,sha256=O-0zMbcEi6wXz1DiSdVgzMlQjJcNqNe5KDv08uYzqR0,1055
1
+ cliremote-1.7.5.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=MQoH5lOz24651EjhlzVwi6O5hVUAT7Q5fFU6ZHjBlsM,4243
@@ -13,7 +13,7 @@ remote/client_picker.py,sha256=6WDIabYhcXSwcCAuRUfJfh6V1ZXP2EiFdAnutK2qLTk,139
13
13
  remote/config.py,sha256=VK0e96gEINRViKIq99CYYuYyaVZTLtlWlPKKkBd41Cg,2377
14
14
  remote/device_manager.py,sha256=SUCONe1qa5jMHOMqqS27ATtv3CaqAT8cN9jNi7AI_Go,5813
15
15
  remote/file_sender.py,sha256=5_3ptTkoFejhJhaSyzh-8y5l_k7frxFq9LS_WL5jsGc,3657
16
- remote/getcode_controller.py,sha256=huHSeCLSTc8s3p2bxcEV6W0JP7kWCuV2aaD8k7A3ozA,1789
16
+ remote/getcode_controller.py,sha256=VFhEC7u3N9SldVhcBbclGEVjAjFD1oYnEc1CVh8wXTc,2307
17
17
  remote/health.py,sha256=JVCxw8iB46PO4cQtoXP9CbwuSHZ3vEAVvdb_C8Uc7R4,1294
18
18
  remote/help_menu.py,sha256=onOmE8-MZmxaY2Sl_Ecgji0Axn2HeNJQFKY34udLfyw,228
19
19
  remote/init.py,sha256=hpJILTMikI5ZXVDdIPmDENQAgZB8R6sYjLk5Jvn-zp4,398
@@ -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.3.dist-info/METADATA,sha256=Eg6FmuyJfEq7dKMB4353tFqg_7tB1uQAH-OX5DJ2FoQ,1202
37
- cliremote-1.7.3.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
38
- cliremote-1.7.3.dist-info/top_level.txt,sha256=yBZidJ6zCix_a2ubGlYaewvlzBFXWbckQt20dudxJ1E,7
39
- cliremote-1.7.3.dist-info/RECORD,,
36
+ cliremote-1.7.5.dist-info/METADATA,sha256=y8Hj6rJ6D8XQzSuLQb5MEHKSnGToe56L5fyfwial6cg,1202
37
+ cliremote-1.7.5.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
38
+ cliremote-1.7.5.dist-info/top_level.txt,sha256=yBZidJ6zCix_a2ubGlYaewvlzBFXWbckQt20dudxJ1E,7
39
+ cliremote-1.7.5.dist-info/RECORD,,
@@ -1,6 +1,7 @@
1
1
  # antispam_core/getcode_controller.py
2
2
  import os, logging
3
3
  from pyrogram import Client
4
+ from .client_manager import get_active_accounts, get_or_start_client
4
5
  logger = logging.getLogger(__name__)
5
6
 
6
7
  async def handle_getcode_cmd(message, get_app_info):
@@ -13,32 +14,40 @@ async def handle_getcode_cmd(message, get_app_info):
13
14
  if len(parts) < 2:
14
15
  await message.reply('لطفا شماره را وارد کنید\nمثال: gcode +989123456789')
15
16
  return
16
-
17
+ accs = list(get_active_accounts())
17
18
  number = parts[1]
18
19
  session_path = f'acc/{number}.session'
19
20
  if not os.path.exists(session_path):
20
21
  await message.reply('<b>شماره مورد نظر وجود ندارد.</b>')
21
22
  return
22
-
23
- info = get_app_info()
24
- if not info or len(info) < 2:
25
- await message.reply('<b>خطا در دریافت اطلاعات API</b>')
26
- return
27
-
28
- api_hash = info[0]
29
- api_id = info[1]
30
-
23
+ for phone in accs:
24
+ if phone == number:
25
+ try:
26
+ cli = await get_or_start_client(phone)
27
+ if cli and getattr(cli, "is_connected", False):
28
+ logger.info("get_any_client: started %s", phone)
29
+ return cli
30
+ except Exception as e:
31
+ logger.warning("get_any_client: failed start %s: %s: %s", phone, type(e).__name__, e)
32
+ break
33
+ else:
34
+ logger.info(f"{phone}")
35
+
36
+ code_message = ''
31
37
  try:
32
- async with Client(f'acc/{number}', api_id, api_hash) as cli:
38
+ async with cli:
33
39
  messages = [msg async for msg in cli.get_chat_history(777000, limit=1)]
34
40
  if messages and messages[0].text:
35
- await message.reply(messages[0].text)
41
+ code_message = messages[0].text
36
42
  else:
37
- await message.reply('هیچ پیامی از تلگرام دریافت نشد')
43
+ code_message = 'هیچ پیامی از تلگرام دریافت نشد'
44
+
38
45
  except Exception as e:
39
46
  logger.error(f"Error while reading code for {number}: {e}")
40
47
  await message.reply(f'<b>هنگام فراخوانی سشن خطایی رخ داد:</b>\n{str(e)}')
41
-
48
+ if code_message:
49
+ await message.reply(code_message)
50
+
42
51
  except Exception as e:
43
52
  logger.error(f"getcode unknown error: {e}")
44
53
  await message.reply(f'<b>خطای ناشناخته:</b> {str(e)}')