d4rktg 0.8.3__py3-none-any.whl → 0.8.4__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/Utils/__init__.py +1 -1
- d4rk/Utils/_round.py +0 -48
- {d4rktg-0.8.3.dist-info → d4rktg-0.8.4.dist-info}/METADATA +1 -1
- {d4rktg-0.8.3.dist-info → d4rktg-0.8.4.dist-info}/RECORD +6 -6
- {d4rktg-0.8.3.dist-info → d4rktg-0.8.4.dist-info}/WHEEL +0 -0
- {d4rktg-0.8.3.dist-info → d4rktg-0.8.4.dist-info}/top_level.txt +0 -0
d4rk/Utils/__init__.py
CHANGED
d4rk/Utils/_round.py
CHANGED
@@ -12,54 +12,6 @@ bot_order_per_chat = {}
|
|
12
12
|
responded_messages = {}
|
13
13
|
chat_locks = {}
|
14
14
|
|
15
|
-
def round():
|
16
|
-
async def func(flt, client, message: Message):
|
17
|
-
chat_id = message.chat.id
|
18
|
-
msg_id = message.id
|
19
|
-
text = message.text or message.caption or ""
|
20
|
-
logger.info(f"RoundRobin filter check for chat_id={chat_id}, msg_id={msg_id} text='{text}'")
|
21
|
-
|
22
|
-
# Initialize per-chat structures
|
23
|
-
if chat_id not in bot_order_per_chat:
|
24
|
-
bot_order_per_chat[chat_id] = [client.me.id]
|
25
|
-
last_index_per_chat[chat_id] = 0
|
26
|
-
responded_messages[chat_id] = set()
|
27
|
-
chat_locks[chat_id] = asyncio.Lock()
|
28
|
-
else:
|
29
|
-
if client.me.id not in bot_order_per_chat[chat_id]:
|
30
|
-
bot_order_per_chat[chat_id].append(client.me.id)
|
31
|
-
|
32
|
-
async with chat_locks[chat_id]:
|
33
|
-
# Skip if already responded
|
34
|
-
if msg_id in responded_messages[chat_id]:
|
35
|
-
logger.info(f"Message {text} in chat {chat_id} already responded by {client.me.first_name}.")
|
36
|
-
logger.info(f"FILTER NOT PASSED - {client.me.first_name} should now execute the command handler")
|
37
|
-
return False
|
38
|
-
|
39
|
-
# Always respond in private chats
|
40
|
-
if message.chat.type.name.lower() == "private":
|
41
|
-
responded_messages[chat_id].add(msg_id)
|
42
|
-
logger.info(f"{client.me.first_name} Responding to private message {text} in chat {chat_id}")
|
43
|
-
logger.info(f"FILTER PASSED - {client.me.first_name} should now execute the command handler")
|
44
|
-
return True
|
45
|
-
|
46
|
-
# In groups, simple round-robin
|
47
|
-
current_index = last_index_per_chat[chat_id]
|
48
|
-
selected_bot_id = bot_order_per_chat[chat_id][current_index]
|
49
|
-
|
50
|
-
# If this bot is selected, mark message and rotate
|
51
|
-
if client.me.id == selected_bot_id:
|
52
|
-
responded_messages[chat_id].add(msg_id)
|
53
|
-
last_index_per_chat[chat_id] = (current_index + 1) % len(bot_order_per_chat[chat_id])
|
54
|
-
logger.info(f"Bot {client.me.first_name} responding to message {text} in chat {chat_id}")
|
55
|
-
logger.info(f"FILTER PASSED - {client.me.first_name} should now execute the command handler")
|
56
|
-
return True
|
57
|
-
else:
|
58
|
-
logger.info(f"Bot {client.me.first_name} not selected to respond to message {text} in chat {chat_id}")
|
59
|
-
return False
|
60
|
-
|
61
|
-
return filters.create(func)
|
62
|
-
|
63
15
|
def round_robin():
|
64
16
|
def decorator(func):
|
65
17
|
@wraps(func)
|
@@ -9,16 +9,16 @@ d4rk/Logs/_logger.py,sha256=lqfVvCO0vZ_IaGOdIE4HA2KAUQZh7yW2iAHZcBz7F4o,4120
|
|
9
9
|
d4rk/Models/__init__.py,sha256=7bYM2c5Uk_VEg7NxIGH2EcEXGcAguwxvH23-Gy1orMM,100
|
10
10
|
d4rk/Models/_commands.py,sha256=_1ageKjA7xNgw7cQsDIjcIuJ96h6DENAZ0Wx1Hm2970,4884
|
11
11
|
d4rk/Models/_movie_title.py,sha256=Xp8eafBP-kD3MxAdeNcb7EyiAojn5fDQ18la7vxrg10,812
|
12
|
-
d4rk/Utils/__init__.py,sha256=
|
12
|
+
d4rk/Utils/__init__.py,sha256=UoZmFq9RIF4lfcxFjt-VQlshsb8-FjUcEjg7qotk6nQ,326
|
13
13
|
d4rk/Utils/_decorators.py,sha256=xplcr3qUSewGKET0Y7TnW2ddL3ZY0IeHS5y3WewB-tc,2672
|
14
14
|
d4rk/Utils/_delete.py,sha256=gSmQAENGmM5XCCJfPuJ4vRMSxtixYG0vYdocU-2TSFg,581
|
15
15
|
d4rk/Utils/_fonts.py,sha256=CQsDqPgvp27t3f75Cxod0EmZogEssLwIpyesH-YY5KM,7518
|
16
16
|
d4rk/Utils/_ip.py,sha256=KJJW2QSngshIVWCO5YPXF1wj4IPQzVN5oFofpfzlU5w,559
|
17
17
|
d4rk/Utils/_movie_parser.py,sha256=QEPd3z04p4pk2vxZ-2fYlRxHmQbmwQd2mCIlBsBM5AY,7039
|
18
18
|
d4rk/Utils/_ractions.py,sha256=wOVPyoFnbDuMgoP6NF_gLO1DYcfhERC0trdAK1jWSE8,2170
|
19
|
-
d4rk/Utils/_round.py,sha256=
|
19
|
+
d4rk/Utils/_round.py,sha256=59nWy-hNDspXbKI31vNea5wSTMvTwNRATHPVQsYkZEA,2028
|
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.4.dist-info/METADATA,sha256=803Gfey2QJNX2wsJo7F_7QsfKOuwjAmCyePou7hqP7I,652
|
22
|
+
d4rktg-0.8.4.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
23
|
+
d4rktg-0.8.4.dist-info/top_level.txt,sha256=qs1qTnKWImmGi7E0FoJS0OAEOHoVZA9vHRS3Pm6ncAo,5
|
24
|
+
d4rktg-0.8.4.dist-info/RECORD,,
|
File without changes
|
File without changes
|