d4rktg 0.4.7__py3-none-any.whl → 0.4.9__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,8 +1,10 @@
1
- from itertools import cycle
2
1
  from functools import wraps
3
2
  from pyrogram.types import Message
4
3
 
5
- last_selected_per_chat = {}
4
+ # Track last bot index per chat
5
+ last_index_per_chat = {}
6
+ # Track all bot IDs dynamically
7
+ active_bot_ids = []
6
8
 
7
9
  def round_robin():
8
10
  def decorator(func):
@@ -14,18 +16,23 @@ def round_robin():
14
16
  if message.chat.type.name.lower() == "private":
15
17
  return await func(client, message, *args, **kwargs)
16
18
 
17
- # If first message in chat, set current bot as last_selected
18
- if chat_id not in last_selected_per_chat:
19
- last_selected_per_chat[chat_id] = client.me.id
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)
20
22
 
21
- # Only the last_selected bot responds
22
- if client.me.id == last_selected_per_chat[chat_id]:
23
+ # Initialize last_index for this chat
24
+ if chat_id not in last_index_per_chat:
25
+ last_index_per_chat[chat_id] = 0
26
+
27
+ current_index = last_index_per_chat[chat_id]
28
+ selected_bot_id = active_bot_ids[current_index]
29
+
30
+ # Only the selected bot responds
31
+ if client.me.id == selected_bot_id:
23
32
  result = await func(client, message, *args, **kwargs)
24
33
 
25
- # rotate: pick the next bot (you'll need a list of bot IDs per chat)
26
- bots_in_chat = list({client.me.id}) # replace with actual bot list
27
- idx = bots_in_chat.index(client.me.id)
28
- last_selected_per_chat[chat_id] = bots_in_chat[(idx + 1) % len(bots_in_chat)]
34
+ # Rotate to next bot index
35
+ last_index_per_chat[chat_id] = (current_index + 1) % len(active_bot_ids)
29
36
  return result
30
37
 
31
38
  return wrapper
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: d4rktg
3
- Version: 0.4.7
3
+ Version: 0.4.9
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=m6zD2aXmEyjybqhXAPa8BPWXeT47CDwf_cWSr9UTfJI,1269
19
+ d4rk/Utils/_round.py,sha256=PSvQGViHXiWX7Ly7MX-p0HlxKdIswngqWeowFTgWQcU,1356
20
20
  d4rk/Utils/_terminal.py,sha256=Anu4OcffY3v6LMOrCskP1cHrJIliomo1Hjownbhh2sQ,125
21
- d4rktg-0.4.7.dist-info/METADATA,sha256=IbHAbarVjp6-5LxIe1_GBrerEql9YD8xeFWzUnFRzc4,652
22
- d4rktg-0.4.7.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
23
- d4rktg-0.4.7.dist-info/top_level.txt,sha256=qs1qTnKWImmGi7E0FoJS0OAEOHoVZA9vHRS3Pm6ncAo,5
24
- d4rktg-0.4.7.dist-info/RECORD,,
21
+ d4rktg-0.4.9.dist-info/METADATA,sha256=OgP5aTWAzsyOJbUudUI_ylg3iXz2QB3DolusW_cNdb0,652
22
+ d4rktg-0.4.9.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
23
+ d4rktg-0.4.9.dist-info/top_level.txt,sha256=qs1qTnKWImmGi7E0FoJS0OAEOHoVZA9vHRS3Pm6ncAo,5
24
+ d4rktg-0.4.9.dist-info/RECORD,,
File without changes