d4rktg 0.8.6__py3-none-any.whl → 0.8.7__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.
d4rk/Models/_commands.py
CHANGED
@@ -9,6 +9,7 @@ from pyrogram.types import Message
|
|
9
9
|
|
10
10
|
from d4rk.Logs import setup_logger
|
11
11
|
from d4rk.Utils import clear_terminal
|
12
|
+
from d4rk.Utils._round import round_robin
|
12
13
|
|
13
14
|
logger = setup_logger(__name__)
|
14
15
|
|
@@ -16,53 +17,6 @@ logger = setup_logger(__name__)
|
|
16
17
|
command_registry = []
|
17
18
|
|
18
19
|
|
19
|
-
last_index_per_chat = {}
|
20
|
-
bot_order_per_chat = {}
|
21
|
-
responded_messages = {}
|
22
|
-
chat_locks = {}
|
23
|
-
|
24
|
-
def round_robin():
|
25
|
-
def decorator(func):
|
26
|
-
@wraps(func)
|
27
|
-
async def wrapper(client, message, *args, **kwargs):
|
28
|
-
chat_id = message.chat.id
|
29
|
-
msg_id = message.id
|
30
|
-
|
31
|
-
# Private chats: all bots respond
|
32
|
-
if message.chat.type.name.lower() == "private":
|
33
|
-
return await func(client, message, *args, **kwargs)
|
34
|
-
|
35
|
-
# Initialize tracking for this chat
|
36
|
-
if chat_id not in bot_order_per_chat:
|
37
|
-
bot_order_per_chat[chat_id] = [client.me.id]
|
38
|
-
last_index_per_chat[chat_id] = 0
|
39
|
-
responded_messages[chat_id] = set()
|
40
|
-
chat_locks[chat_id] = asyncio.Lock()
|
41
|
-
|
42
|
-
# Add new bot if not in the chat
|
43
|
-
if client.me.id not in bot_order_per_chat[chat_id]:
|
44
|
-
bot_order_per_chat[chat_id].append(client.me.id)
|
45
|
-
|
46
|
-
async with chat_locks[chat_id]:
|
47
|
-
# Skip if message already responded
|
48
|
-
if msg_id in responded_messages[chat_id]:
|
49
|
-
return
|
50
|
-
|
51
|
-
# Decide which bot should respond
|
52
|
-
current_index = last_index_per_chat[chat_id]
|
53
|
-
selected_bot_id = bot_order_per_chat[chat_id][current_index]
|
54
|
-
|
55
|
-
if client.me.id == selected_bot_id:
|
56
|
-
result = await func(client, message, *args, **kwargs)
|
57
|
-
# Mark message as responded
|
58
|
-
responded_messages[chat_id].add(msg_id)
|
59
|
-
# Rotate for next message
|
60
|
-
last_index_per_chat[chat_id] = (current_index + 1) % len(bot_order_per_chat[chat_id])
|
61
|
-
return result
|
62
|
-
|
63
|
-
return wrapper
|
64
|
-
return decorator
|
65
|
-
|
66
20
|
def get_priority(description: str) -> int:
|
67
21
|
desc_lower = description.lower()
|
68
22
|
if "(owner only)" in desc_lower:
|
@@ -7,7 +7,7 @@ d4rk/Handlers/_scheduler.py,sha256=AyqexO4nxZlIzRfU9vWTfJtTWQVQmP4de7GRPg-3JkA,1
|
|
7
7
|
d4rk/Logs/__init__.py,sha256=mXWD5jXnyH3_AvS7K_ki3iw5BpoEAvrDFbmr-iEFNnY,22
|
8
8
|
d4rk/Logs/_logger.py,sha256=lqfVvCO0vZ_IaGOdIE4HA2KAUQZh7yW2iAHZcBz7F4o,4120
|
9
9
|
d4rk/Models/__init__.py,sha256=7bYM2c5Uk_VEg7NxIGH2EcEXGcAguwxvH23-Gy1orMM,100
|
10
|
-
d4rk/Models/_commands.py,sha256=
|
10
|
+
d4rk/Models/_commands.py,sha256=k5gtoUYygPg9Zee7FnKmuajwYGJw7pxvbLtRCePccnI,3092
|
11
11
|
d4rk/Models/_movie_title.py,sha256=Xp8eafBP-kD3MxAdeNcb7EyiAojn5fDQ18la7vxrg10,812
|
12
12
|
d4rk/Utils/__init__.py,sha256=UoZmFq9RIF4lfcxFjt-VQlshsb8-FjUcEjg7qotk6nQ,326
|
13
13
|
d4rk/Utils/_decorators.py,sha256=xplcr3qUSewGKET0Y7TnW2ddL3ZY0IeHS5y3WewB-tc,2672
|
@@ -18,7 +18,7 @@ d4rk/Utils/_movie_parser.py,sha256=QEPd3z04p4pk2vxZ-2fYlRxHmQbmwQd2mCIlBsBM5AY,7
|
|
18
18
|
d4rk/Utils/_ractions.py,sha256=wOVPyoFnbDuMgoP6NF_gLO1DYcfhERC0trdAK1jWSE8,2170
|
19
19
|
d4rk/Utils/_round.py,sha256=LaQlklg4f8n4cJjVzeYisd8l9D1gYNuQ9Ka41v8XWtE,1696
|
20
20
|
d4rk/Utils/_terminal.py,sha256=Anu4OcffY3v6LMOrCskP1cHrJIliomo1Hjownbhh2sQ,125
|
21
|
-
d4rktg-0.8.
|
22
|
-
d4rktg-0.8.
|
23
|
-
d4rktg-0.8.
|
24
|
-
d4rktg-0.8.
|
21
|
+
d4rktg-0.8.7.dist-info/METADATA,sha256=mhVTh9guosqyIAh21oauEfjK4rusemBBiqFFR5n9FM4,652
|
22
|
+
d4rktg-0.8.7.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
23
|
+
d4rktg-0.8.7.dist-info/top_level.txt,sha256=qs1qTnKWImmGi7E0FoJS0OAEOHoVZA9vHRS3Pm6ncAo,5
|
24
|
+
d4rktg-0.8.7.dist-info/RECORD,,
|
File without changes
|
File without changes
|