d4rktg 0.4.6__py3-none-any.whl → 0.4.8__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/_round.py CHANGED
@@ -1,34 +1,37 @@
1
- from itertools import cycle
2
1
  from functools import wraps
3
2
  from pyrogram.types import Message
4
3
 
5
- last_selected = None
6
- bot_order = []
4
+ # Track last bot per chat
5
+ last_selected_per_chat = {}
6
+ # Track all bot IDs dynamically
7
+ active_bot_ids = []
7
8
 
8
9
  def round_robin():
9
10
  def decorator(func):
10
11
  @wraps(func)
11
- async def wrapper(client, message: Message, *args, **kwargs):
12
- global last_selected, bot_order
12
+ async def wrapper(client, message: Message):
13
+ chat_id = message.chat.id
13
14
 
14
15
  # Private chats: all bots respond
15
16
  if message.chat.type.name.lower() == "private":
16
- return await func(client, message, *args, **kwargs)
17
+ return await func(client, message)
17
18
 
18
- # If this chat is new, start order dynamically
19
- chat_id = message.chat.id
20
- if chat_id not in bot_order:
21
- bot_order.append(client.me.id)
22
- last_selected = client.me.id
23
-
24
- # Only the "current" bot responds
25
- if client.me.id == last_selected:
26
- result = await func(client, message, *args, **kwargs)
27
-
28
- # Rotate for next message
29
- alive_bots = [b for b in bot_order if b is not None] # optionally skip dead bots
30
- idx = alive_bots.index(last_selected)
31
- last_selected = alive_bots[(idx + 1) % len(alive_bots)]
19
+ # Add bot ID to active list dynamically
20
+ if client.me.id not in active_bot_ids:
21
+ active_bot_ids.append(client.me.id)
22
+
23
+ # Initialize last_selected for this chat
24
+ if chat_id not in last_selected_per_chat:
25
+ last_selected_per_chat[chat_id] = client.me.id
26
+
27
+ # Only the selected bot responds
28
+ if client.me.id == last_selected_per_chat[chat_id]:
29
+ result = await func(client, message)
30
+
31
+ # Rotate to the next bot
32
+ idx = active_bot_ids.index(client.me.id)
33
+ last_selected_per_chat[chat_id] = active_bot_ids[(idx + 1) % len(active_bot_ids)]
32
34
  return result
35
+
33
36
  return wrapper
34
- return decorator
37
+ return decorator
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: d4rktg
3
- Version: 0.4.6
3
+ Version: 0.4.8
4
4
  Summary: A module for create with easy and fast
5
5
  Author: D4rkShell
6
6
  Author-email: premiumqtrst@gmail.com
@@ -16,9 +16,9 @@ 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=1WvpEe6OTqYBIDevwymHubAtQWLvK5E-v01Gzi0HuZ8,1250
19
+ d4rk/Utils/_round.py,sha256=lN1nX_pZtI3NSGtwZFKyQb08Z1UfBp21yy-STk07H-Q,1284
20
20
  d4rk/Utils/_terminal.py,sha256=Anu4OcffY3v6LMOrCskP1cHrJIliomo1Hjownbhh2sQ,125
21
- d4rktg-0.4.6.dist-info/METADATA,sha256=qQfYbnt4ESbrfwvIN4x2k7YcWOWSIbrWwCSIBBKpT9U,652
22
- d4rktg-0.4.6.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
23
- d4rktg-0.4.6.dist-info/top_level.txt,sha256=qs1qTnKWImmGi7E0FoJS0OAEOHoVZA9vHRS3Pm6ncAo,5
24
- d4rktg-0.4.6.dist-info/RECORD,,
21
+ d4rktg-0.4.8.dist-info/METADATA,sha256=jakFy65I6iIvg-2O1XoZNtX-dUbNgUxp0lZNKzT7bEs,652
22
+ d4rktg-0.4.8.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
23
+ d4rktg-0.4.8.dist-info/top_level.txt,sha256=qs1qTnKWImmGi7E0FoJS0OAEOHoVZA9vHRS3Pm6ncAo,5
24
+ d4rktg-0.4.8.dist-info/RECORD,,
File without changes