d4rktg 0.4.6__py3-none-any.whl → 0.4.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/Utils/_round.py CHANGED
@@ -2,33 +2,31 @@ from itertools import cycle
2
2
  from functools import wraps
3
3
  from pyrogram.types import Message
4
4
 
5
- last_selected = None
6
- bot_order = []
5
+ last_selected_per_chat = {}
7
6
 
8
7
  def round_robin():
9
8
  def decorator(func):
10
9
  @wraps(func)
11
10
  async def wrapper(client, message: Message, *args, **kwargs):
12
- global last_selected, bot_order
11
+ chat_id = message.chat.id
13
12
 
14
13
  # Private chats: all bots respond
15
14
  if message.chat.type.name.lower() == "private":
16
15
  return await func(client, message, *args, **kwargs)
17
16
 
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
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
23
20
 
24
- # Only the "current" bot responds
25
- if client.me.id == last_selected:
21
+ # Only the last_selected bot responds
22
+ if client.me.id == last_selected_per_chat[chat_id]:
26
23
  result = await func(client, message, *args, **kwargs)
27
24
 
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)]
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)]
32
29
  return result
30
+
33
31
  return wrapper
34
32
  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.7
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=m6zD2aXmEyjybqhXAPa8BPWXeT47CDwf_cWSr9UTfJI,1269
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.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,,
File without changes