d4rktg 0.4.7__tar.gz → 0.4.8__tar.gz
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.
- {d4rktg-0.4.7 → d4rktg-0.4.8}/PKG-INFO +1 -1
- d4rktg-0.4.8/VERSION.txt +1 -0
- d4rktg-0.4.8/d4rk/Utils/_round.py +37 -0
- {d4rktg-0.4.7 → d4rktg-0.4.8}/d4rktg.egg-info/PKG-INFO +1 -1
- d4rktg-0.4.7/VERSION.txt +0 -1
- d4rktg-0.4.7/d4rk/Utils/_round.py +0 -32
- {d4rktg-0.4.7 → d4rktg-0.4.8}/MANIFEST.in +0 -0
- {d4rktg-0.4.7 → d4rktg-0.4.8}/README.rst +0 -0
- {d4rktg-0.4.7 → d4rktg-0.4.8}/d4rk/Database/__init__.py +0 -0
- {d4rktg-0.4.7 → d4rktg-0.4.8}/d4rk/Database/db.py +0 -0
- {d4rktg-0.4.7 → d4rktg-0.4.8}/d4rk/Handlers/__init__.py +0 -0
- {d4rktg-0.4.7 → d4rktg-0.4.8}/d4rk/Handlers/_bot.py +0 -0
- {d4rktg-0.4.7 → d4rktg-0.4.8}/d4rk/Handlers/_scheduler.py +0 -0
- {d4rktg-0.4.7 → d4rktg-0.4.8}/d4rk/Logs/__init__.py +0 -0
- {d4rktg-0.4.7 → d4rktg-0.4.8}/d4rk/Logs/_logger.py +0 -0
- {d4rktg-0.4.7 → d4rktg-0.4.8}/d4rk/Models/__init__.py +0 -0
- {d4rktg-0.4.7 → d4rktg-0.4.8}/d4rk/Models/_commands.py +0 -0
- {d4rktg-0.4.7 → d4rktg-0.4.8}/d4rk/Models/_movie_title.py +0 -0
- {d4rktg-0.4.7 → d4rktg-0.4.8}/d4rk/Utils/__init__.py +0 -0
- {d4rktg-0.4.7 → d4rktg-0.4.8}/d4rk/Utils/_decorators.py +0 -0
- {d4rktg-0.4.7 → d4rktg-0.4.8}/d4rk/Utils/_delete.py +0 -0
- {d4rktg-0.4.7 → d4rktg-0.4.8}/d4rk/Utils/_fonts.py +0 -0
- {d4rktg-0.4.7 → d4rktg-0.4.8}/d4rk/Utils/_ip.py +0 -0
- {d4rktg-0.4.7 → d4rktg-0.4.8}/d4rk/Utils/_movie_parser.py +0 -0
- {d4rktg-0.4.7 → d4rktg-0.4.8}/d4rk/Utils/_ractions.py +0 -0
- {d4rktg-0.4.7 → d4rktg-0.4.8}/d4rk/Utils/_terminal.py +0 -0
- {d4rktg-0.4.7 → d4rktg-0.4.8}/d4rk/__init__.py +0 -0
- {d4rktg-0.4.7 → d4rktg-0.4.8}/d4rktg.egg-info/SOURCES.txt +0 -0
- {d4rktg-0.4.7 → d4rktg-0.4.8}/d4rktg.egg-info/dependency_links.txt +0 -0
- {d4rktg-0.4.7 → d4rktg-0.4.8}/d4rktg.egg-info/requires.txt +0 -0
- {d4rktg-0.4.7 → d4rktg-0.4.8}/d4rktg.egg-info/top_level.txt +0 -0
- {d4rktg-0.4.7 → d4rktg-0.4.8}/requirements.txt +0 -0
- {d4rktg-0.4.7 → d4rktg-0.4.8}/setup.cfg +0 -0
- {d4rktg-0.4.7 → d4rktg-0.4.8}/setup.py +0 -0
d4rktg-0.4.8/VERSION.txt
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.4.8
|
@@ -0,0 +1,37 @@
|
|
1
|
+
from functools import wraps
|
2
|
+
from pyrogram.types import Message
|
3
|
+
|
4
|
+
# Track last bot per chat
|
5
|
+
last_selected_per_chat = {}
|
6
|
+
# Track all bot IDs dynamically
|
7
|
+
active_bot_ids = []
|
8
|
+
|
9
|
+
def round_robin():
|
10
|
+
def decorator(func):
|
11
|
+
@wraps(func)
|
12
|
+
async def wrapper(client, message: Message):
|
13
|
+
chat_id = message.chat.id
|
14
|
+
|
15
|
+
# Private chats: all bots respond
|
16
|
+
if message.chat.type.name.lower() == "private":
|
17
|
+
return await func(client, message)
|
18
|
+
|
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)]
|
34
|
+
return result
|
35
|
+
|
36
|
+
return wrapper
|
37
|
+
return decorator
|
d4rktg-0.4.7/VERSION.txt
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
0.4.7
|
@@ -1,32 +0,0 @@
|
|
1
|
-
from itertools import cycle
|
2
|
-
from functools import wraps
|
3
|
-
from pyrogram.types import Message
|
4
|
-
|
5
|
-
last_selected_per_chat = {}
|
6
|
-
|
7
|
-
def round_robin():
|
8
|
-
def decorator(func):
|
9
|
-
@wraps(func)
|
10
|
-
async def wrapper(client, message: Message, *args, **kwargs):
|
11
|
-
chat_id = message.chat.id
|
12
|
-
|
13
|
-
# Private chats: all bots respond
|
14
|
-
if message.chat.type.name.lower() == "private":
|
15
|
-
return await func(client, message, *args, **kwargs)
|
16
|
-
|
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
|
20
|
-
|
21
|
-
# Only the last_selected bot responds
|
22
|
-
if client.me.id == last_selected_per_chat[chat_id]:
|
23
|
-
result = await func(client, message, *args, **kwargs)
|
24
|
-
|
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)]
|
29
|
-
return result
|
30
|
-
|
31
|
-
return wrapper
|
32
|
-
return decorator
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|