d4rktg 0.4.6__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.6 → 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.6 → d4rktg-0.4.8}/d4rktg.egg-info/PKG-INFO +1 -1
- d4rktg-0.4.6/VERSION.txt +0 -1
- d4rktg-0.4.6/d4rk/Utils/_round.py +0 -34
- {d4rktg-0.4.6 → d4rktg-0.4.8}/MANIFEST.in +0 -0
- {d4rktg-0.4.6 → d4rktg-0.4.8}/README.rst +0 -0
- {d4rktg-0.4.6 → d4rktg-0.4.8}/d4rk/Database/__init__.py +0 -0
- {d4rktg-0.4.6 → d4rktg-0.4.8}/d4rk/Database/db.py +0 -0
- {d4rktg-0.4.6 → d4rktg-0.4.8}/d4rk/Handlers/__init__.py +0 -0
- {d4rktg-0.4.6 → d4rktg-0.4.8}/d4rk/Handlers/_bot.py +0 -0
- {d4rktg-0.4.6 → d4rktg-0.4.8}/d4rk/Handlers/_scheduler.py +0 -0
- {d4rktg-0.4.6 → d4rktg-0.4.8}/d4rk/Logs/__init__.py +0 -0
- {d4rktg-0.4.6 → d4rktg-0.4.8}/d4rk/Logs/_logger.py +0 -0
- {d4rktg-0.4.6 → d4rktg-0.4.8}/d4rk/Models/__init__.py +0 -0
- {d4rktg-0.4.6 → d4rktg-0.4.8}/d4rk/Models/_commands.py +0 -0
- {d4rktg-0.4.6 → d4rktg-0.4.8}/d4rk/Models/_movie_title.py +0 -0
- {d4rktg-0.4.6 → d4rktg-0.4.8}/d4rk/Utils/__init__.py +0 -0
- {d4rktg-0.4.6 → d4rktg-0.4.8}/d4rk/Utils/_decorators.py +0 -0
- {d4rktg-0.4.6 → d4rktg-0.4.8}/d4rk/Utils/_delete.py +0 -0
- {d4rktg-0.4.6 → d4rktg-0.4.8}/d4rk/Utils/_fonts.py +0 -0
- {d4rktg-0.4.6 → d4rktg-0.4.8}/d4rk/Utils/_ip.py +0 -0
- {d4rktg-0.4.6 → d4rktg-0.4.8}/d4rk/Utils/_movie_parser.py +0 -0
- {d4rktg-0.4.6 → d4rktg-0.4.8}/d4rk/Utils/_ractions.py +0 -0
- {d4rktg-0.4.6 → d4rktg-0.4.8}/d4rk/Utils/_terminal.py +0 -0
- {d4rktg-0.4.6 → d4rktg-0.4.8}/d4rk/__init__.py +0 -0
- {d4rktg-0.4.6 → d4rktg-0.4.8}/d4rktg.egg-info/SOURCES.txt +0 -0
- {d4rktg-0.4.6 → d4rktg-0.4.8}/d4rktg.egg-info/dependency_links.txt +0 -0
- {d4rktg-0.4.6 → d4rktg-0.4.8}/d4rktg.egg-info/requires.txt +0 -0
- {d4rktg-0.4.6 → d4rktg-0.4.8}/d4rktg.egg-info/top_level.txt +0 -0
- {d4rktg-0.4.6 → d4rktg-0.4.8}/requirements.txt +0 -0
- {d4rktg-0.4.6 → d4rktg-0.4.8}/setup.cfg +0 -0
- {d4rktg-0.4.6 → 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.6/VERSION.txt
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
0.4.6
|
@@ -1,34 +0,0 @@
|
|
1
|
-
from itertools import cycle
|
2
|
-
from functools import wraps
|
3
|
-
from pyrogram.types import Message
|
4
|
-
|
5
|
-
last_selected = None
|
6
|
-
bot_order = []
|
7
|
-
|
8
|
-
def round_robin():
|
9
|
-
def decorator(func):
|
10
|
-
@wraps(func)
|
11
|
-
async def wrapper(client, message: Message, *args, **kwargs):
|
12
|
-
global last_selected, bot_order
|
13
|
-
|
14
|
-
# Private chats: all bots respond
|
15
|
-
if message.chat.type.name.lower() == "private":
|
16
|
-
return await func(client, message, *args, **kwargs)
|
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
|
25
|
-
if client.me.id == last_selected:
|
26
|
-
result = await func(client, message, *args, **kwargs)
|
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)]
|
32
|
-
return result
|
33
|
-
return wrapper
|
34
|
-
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
|