d4rktg 0.4.8__tar.gz → 0.5.0__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.8 → d4rktg-0.5.0}/PKG-INFO +1 -1
- d4rktg-0.5.0/VERSION.txt +1 -0
- d4rktg-0.5.0/d4rk/Utils/_round.py +49 -0
- {d4rktg-0.4.8 → d4rktg-0.5.0}/d4rktg.egg-info/PKG-INFO +1 -1
- d4rktg-0.4.8/VERSION.txt +0 -1
- d4rktg-0.4.8/d4rk/Utils/_round.py +0 -37
- {d4rktg-0.4.8 → d4rktg-0.5.0}/MANIFEST.in +0 -0
- {d4rktg-0.4.8 → d4rktg-0.5.0}/README.rst +0 -0
- {d4rktg-0.4.8 → d4rktg-0.5.0}/d4rk/Database/__init__.py +0 -0
- {d4rktg-0.4.8 → d4rktg-0.5.0}/d4rk/Database/db.py +0 -0
- {d4rktg-0.4.8 → d4rktg-0.5.0}/d4rk/Handlers/__init__.py +0 -0
- {d4rktg-0.4.8 → d4rktg-0.5.0}/d4rk/Handlers/_bot.py +0 -0
- {d4rktg-0.4.8 → d4rktg-0.5.0}/d4rk/Handlers/_scheduler.py +0 -0
- {d4rktg-0.4.8 → d4rktg-0.5.0}/d4rk/Logs/__init__.py +0 -0
- {d4rktg-0.4.8 → d4rktg-0.5.0}/d4rk/Logs/_logger.py +0 -0
- {d4rktg-0.4.8 → d4rktg-0.5.0}/d4rk/Models/__init__.py +0 -0
- {d4rktg-0.4.8 → d4rktg-0.5.0}/d4rk/Models/_commands.py +0 -0
- {d4rktg-0.4.8 → d4rktg-0.5.0}/d4rk/Models/_movie_title.py +0 -0
- {d4rktg-0.4.8 → d4rktg-0.5.0}/d4rk/Utils/__init__.py +0 -0
- {d4rktg-0.4.8 → d4rktg-0.5.0}/d4rk/Utils/_decorators.py +0 -0
- {d4rktg-0.4.8 → d4rktg-0.5.0}/d4rk/Utils/_delete.py +0 -0
- {d4rktg-0.4.8 → d4rktg-0.5.0}/d4rk/Utils/_fonts.py +0 -0
- {d4rktg-0.4.8 → d4rktg-0.5.0}/d4rk/Utils/_ip.py +0 -0
- {d4rktg-0.4.8 → d4rktg-0.5.0}/d4rk/Utils/_movie_parser.py +0 -0
- {d4rktg-0.4.8 → d4rktg-0.5.0}/d4rk/Utils/_ractions.py +0 -0
- {d4rktg-0.4.8 → d4rktg-0.5.0}/d4rk/Utils/_terminal.py +0 -0
- {d4rktg-0.4.8 → d4rktg-0.5.0}/d4rk/__init__.py +0 -0
- {d4rktg-0.4.8 → d4rktg-0.5.0}/d4rktg.egg-info/SOURCES.txt +0 -0
- {d4rktg-0.4.8 → d4rktg-0.5.0}/d4rktg.egg-info/dependency_links.txt +0 -0
- {d4rktg-0.4.8 → d4rktg-0.5.0}/d4rktg.egg-info/requires.txt +0 -0
- {d4rktg-0.4.8 → d4rktg-0.5.0}/d4rktg.egg-info/top_level.txt +0 -0
- {d4rktg-0.4.8 → d4rktg-0.5.0}/requirements.txt +0 -0
- {d4rktg-0.4.8 → d4rktg-0.5.0}/setup.cfg +0 -0
- {d4rktg-0.4.8 → d4rktg-0.5.0}/setup.py +0 -0
d4rktg-0.5.0/VERSION.txt
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.5.0
|
@@ -0,0 +1,49 @@
|
|
1
|
+
from functools import wraps
|
2
|
+
from pyrogram.types import Message
|
3
|
+
|
4
|
+
# Track last bot index per chat
|
5
|
+
last_index_per_chat = {}
|
6
|
+
# Track bot order per chat
|
7
|
+
bot_order_per_chat = {}
|
8
|
+
# Track messages already responded to: chat_id -> set of message_ids
|
9
|
+
responded_messages = {}
|
10
|
+
|
11
|
+
def round_robin():
|
12
|
+
def decorator(func):
|
13
|
+
@wraps(func)
|
14
|
+
async def wrapper(client, message: Message, *args, **kwargs):
|
15
|
+
chat_id = message.chat.id
|
16
|
+
msg_id = message.id
|
17
|
+
|
18
|
+
# Private chats: all bots respond
|
19
|
+
if message.chat.type.name.lower() == "private":
|
20
|
+
return await func(client, message, *args, **kwargs)
|
21
|
+
|
22
|
+
# Initialize tracking for this chat
|
23
|
+
if chat_id not in bot_order_per_chat:
|
24
|
+
bot_order_per_chat[chat_id] = [client.me.id]
|
25
|
+
last_index_per_chat[chat_id] = 0
|
26
|
+
responded_messages[chat_id] = set()
|
27
|
+
|
28
|
+
# Skip if message already responded by any bot
|
29
|
+
if msg_id in responded_messages[chat_id]:
|
30
|
+
return
|
31
|
+
|
32
|
+
# Add new bots if not in the chat
|
33
|
+
if client.me.id not in bot_order_per_chat[chat_id]:
|
34
|
+
bot_order_per_chat[chat_id].append(client.me.id)
|
35
|
+
|
36
|
+
current_index = last_index_per_chat[chat_id]
|
37
|
+
selected_bot_id = bot_order_per_chat[chat_id][current_index]
|
38
|
+
|
39
|
+
# Only selected bot responds
|
40
|
+
if client.me.id == selected_bot_id:
|
41
|
+
result = await func(client, message, *args, **kwargs)
|
42
|
+
# Mark message as responded
|
43
|
+
responded_messages[chat_id].add(msg_id)
|
44
|
+
# Rotate index
|
45
|
+
last_index_per_chat[chat_id] = (current_index + 1) % len(bot_order_per_chat[chat_id])
|
46
|
+
return result
|
47
|
+
|
48
|
+
return wrapper
|
49
|
+
return decorator
|
d4rktg-0.4.8/VERSION.txt
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
0.4.8
|
@@ -1,37 +0,0 @@
|
|
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
|
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
|