d4rktg 0.4.3__py3-none-any.whl → 0.4.5__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,26 +1,34 @@
|
|
1
1
|
from itertools import cycle
|
2
2
|
from functools import wraps
|
3
|
-
from pyrogram import Message
|
3
|
+
from pyrogram.types import Message
|
4
4
|
|
5
|
-
bot_cycle = None
|
6
5
|
last_selected = None
|
7
|
-
|
8
|
-
def set_bot_cycle(bot_ids):
|
9
|
-
global bot_cycle
|
10
|
-
bot_cycle = cycle(bot_ids)
|
6
|
+
bot_order = []
|
11
7
|
|
12
8
|
def round_robin():
|
13
9
|
def decorator(func):
|
14
10
|
@wraps(func)
|
15
|
-
async def wrapper(client, message:Message, *args, **kwargs):
|
16
|
-
global last_selected,
|
11
|
+
async def wrapper(client, message: Message, *args, **kwargs):
|
12
|
+
global last_selected, bot_order
|
13
|
+
|
14
|
+
# Private chats: all bots respond
|
17
15
|
if message.chat.type.name.lower() == "private":
|
18
16
|
return await func(client, message, *args, **kwargs)
|
19
|
-
|
20
|
-
|
17
|
+
|
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
|
21
25
|
if client.me.id == last_selected:
|
22
26
|
result = await func(client, message, *args, **kwargs)
|
23
|
-
|
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)]
|
24
32
|
return result
|
25
33
|
return wrapper
|
26
34
|
return decorator
|
@@ -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=
|
19
|
+
d4rk/Utils/_round.py,sha256=UswQKz9aTiJ4zA4JBqSSAJ7Y2IYBjb0XYP1cCDiSL28,1252
|
20
20
|
d4rk/Utils/_terminal.py,sha256=Anu4OcffY3v6LMOrCskP1cHrJIliomo1Hjownbhh2sQ,125
|
21
|
-
d4rktg-0.4.
|
22
|
-
d4rktg-0.4.
|
23
|
-
d4rktg-0.4.
|
24
|
-
d4rktg-0.4.
|
21
|
+
d4rktg-0.4.5.dist-info/METADATA,sha256=QNJuUUb4J8mmDWyqjXvL4DMeRlFjyFshGEnfjnNJoiQ,652
|
22
|
+
d4rktg-0.4.5.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
23
|
+
d4rktg-0.4.5.dist-info/top_level.txt,sha256=qs1qTnKWImmGi7E0FoJS0OAEOHoVZA9vHRS3Pm6ncAo,5
|
24
|
+
d4rktg-0.4.5.dist-info/RECORD,,
|
File without changes
|
File without changes
|