d4rktg 1.0.7__tar.gz → 1.0.9__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-1.0.7/d4rktg.egg-info → d4rktg-1.0.9}/PKG-INFO +1 -1
- d4rktg-1.0.9/VERSION.txt +1 -0
- d4rktg-1.0.9/d4rk/Handlers/_custom.py +114 -0
- {d4rktg-1.0.7 → d4rktg-1.0.9}/d4rk/Utils/_decorators.py +2 -1
- {d4rktg-1.0.7 → d4rktg-1.0.9/d4rktg.egg-info}/PKG-INFO +1 -1
- d4rktg-1.0.7/VERSION.txt +0 -1
- d4rktg-1.0.7/d4rk/Handlers/_custom.py +0 -98
- {d4rktg-1.0.7 → d4rktg-1.0.9}/MANIFEST.in +0 -0
- {d4rktg-1.0.7 → d4rktg-1.0.9}/README.rst +0 -0
- {d4rktg-1.0.7 → d4rktg-1.0.9}/d4rk/Database/__init__.py +0 -0
- {d4rktg-1.0.7 → d4rktg-1.0.9}/d4rk/Database/db.py +0 -0
- {d4rktg-1.0.7 → d4rktg-1.0.9}/d4rk/Handlers/__init__.py +0 -0
- {d4rktg-1.0.7 → d4rktg-1.0.9}/d4rk/Handlers/_bot.py +0 -0
- {d4rktg-1.0.7 → d4rktg-1.0.9}/d4rk/Handlers/_scheduler.py +0 -0
- {d4rktg-1.0.7 → d4rktg-1.0.9}/d4rk/Logs/__init__.py +0 -0
- {d4rktg-1.0.7 → d4rktg-1.0.9}/d4rk/Logs/_logger.py +0 -0
- {d4rktg-1.0.7 → d4rktg-1.0.9}/d4rk/Utils/__init__.py +0 -0
- {d4rktg-1.0.7 → d4rktg-1.0.9}/d4rk/Utils/_buttons.py +0 -0
- {d4rktg-1.0.7 → d4rktg-1.0.9}/d4rk/Utils/_filters.py +0 -0
- {d4rktg-1.0.7 → d4rktg-1.0.9}/d4rk/Utils/_fonts.py +0 -0
- {d4rktg-1.0.7 → d4rktg-1.0.9}/d4rk/Utils/_ip.py +0 -0
- {d4rktg-1.0.7 → d4rktg-1.0.9}/d4rk/Utils/_movie_parser.py +0 -0
- {d4rktg-1.0.7 → d4rktg-1.0.9}/d4rk/Utils/_ractions.py +0 -0
- {d4rktg-1.0.7 → d4rktg-1.0.9}/d4rk/Utils/_terminal.py +0 -0
- {d4rktg-1.0.7 → d4rktg-1.0.9}/d4rk/__init__.py +0 -0
- {d4rktg-1.0.7 → d4rktg-1.0.9}/d4rktg.egg-info/SOURCES.txt +0 -0
- {d4rktg-1.0.7 → d4rktg-1.0.9}/d4rktg.egg-info/dependency_links.txt +0 -0
- {d4rktg-1.0.7 → d4rktg-1.0.9}/d4rktg.egg-info/requires.txt +0 -0
- {d4rktg-1.0.7 → d4rktg-1.0.9}/d4rktg.egg-info/top_level.txt +0 -0
- {d4rktg-1.0.7 → d4rktg-1.0.9}/requirements.txt +0 -0
- {d4rktg-1.0.7 → d4rktg-1.0.9}/setup.cfg +0 -0
- {d4rktg-1.0.7 → d4rktg-1.0.9}/setup.py +0 -0
d4rktg-1.0.9/VERSION.txt
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
1.0.9
|
@@ -0,0 +1,114 @@
|
|
1
|
+
|
2
|
+
import pyrogram.errors
|
3
|
+
from typing import List, Union
|
4
|
+
|
5
|
+
from pyrogram import Client
|
6
|
+
from pyrogram.enums import ParseMode
|
7
|
+
from pyrogram.errors import FloodWait
|
8
|
+
from pyrogram.types import Message, CallbackQuery
|
9
|
+
|
10
|
+
from d4rk.Utils._fonts import get_font
|
11
|
+
from d4rk.Utils._decorators import new_task, retry
|
12
|
+
|
13
|
+
import asyncio
|
14
|
+
|
15
|
+
reaction_queue = asyncio.Queue()
|
16
|
+
semaphore = asyncio.Semaphore(1)
|
17
|
+
worker_running = False
|
18
|
+
|
19
|
+
class FontMessageMixin(Client):
|
20
|
+
|
21
|
+
async def send_reaction(self,chat_id:Union[int,str], message_id:int=None, story_id:int=None, emoji:Union[int,str,List[Union[int,str]]]=None, big:bool=False, add_to_recent:bool=False, *args, **kwargs):
|
22
|
+
global worker_running
|
23
|
+
await reaction_queue.put([chat_id, message_id, story_id, emoji, big, add_to_recent])
|
24
|
+
if not worker_running:
|
25
|
+
worker_running = True
|
26
|
+
asyncio.create_task(self.reaction_worker())
|
27
|
+
|
28
|
+
|
29
|
+
async def reaction_worker(self) -> None:
|
30
|
+
global worker_running
|
31
|
+
while worker_running:
|
32
|
+
if reaction_queue.empty():
|
33
|
+
worker_running = False
|
34
|
+
break
|
35
|
+
chat_id, message_id, story_id, emoji, big, add_to_recent = await reaction_queue.get()
|
36
|
+
async def job() -> None:
|
37
|
+
async with semaphore:
|
38
|
+
try:
|
39
|
+
await self._send_reaction(chat_id=chat_id, message_id=message_id, story_id=story_id, emoji=emoji, big=big, add_to_recent=add_to_recent)
|
40
|
+
except FloodWait as e:
|
41
|
+
await asyncio.sleep(e.value)
|
42
|
+
try:await self._send_reaction(chat_id=chat_id, message_id=message_id, story_id=story_id, emoji=emoji, big=big, add_to_recent=add_to_recent)
|
43
|
+
except:pass
|
44
|
+
finally:reaction_queue.task_done()
|
45
|
+
await asyncio.sleep(5)
|
46
|
+
asyncio.create_task(job())
|
47
|
+
|
48
|
+
async def _send_reaction(self,*args, **kwargs):
|
49
|
+
return await super().send_reaction(*args, **kwargs)
|
50
|
+
|
51
|
+
@retry()
|
52
|
+
async def delete_message(self,chat_id:Union[int,str], message_ids:Union[int,List[int]], revoke:bool=True, wait: int = 0):
|
53
|
+
if wait > 0: await asyncio.sleep(wait)
|
54
|
+
await super().delete_messages(chat_id=chat_id, message_ids=message_ids, revoke=revoke)
|
55
|
+
|
56
|
+
async def send_message(self, chat_id :Union[int, str], text :str, parse_mode=None, *args, **kwargs):
|
57
|
+
try:return await super().send_message(chat_id=chat_id, text=get_font(text=text, font=self.font), parse_mode=ParseMode.HTML, *args, **kwargs)
|
58
|
+
except FloodWait as e:
|
59
|
+
await asyncio.sleep(e.value)
|
60
|
+
return await self.send_message(chat_id=chat_id, text=get_font(text=text, font=self.font), parse_mode=ParseMode.HTML, *args, **kwargs)
|
61
|
+
|
62
|
+
async def send_photo(self, chat_id:Union[int, str], photo :str, caption :str=None, parse_mode=None, *args, **kwargs):
|
63
|
+
try:return await super().send_photo(chat_id=chat_id, photo=photo, caption=get_font(text=caption, font=self.font), parse_mode=ParseMode.HTML, *args, **kwargs)
|
64
|
+
except FloodWait as e:
|
65
|
+
await asyncio.sleep(e.value)
|
66
|
+
return await self.send_photo(chat_id=chat_id, photo=photo, caption=get_font(text=caption, font=self.font), parse_mode=ParseMode.HTML, *args, **kwargs)
|
67
|
+
|
68
|
+
async def edit_message_text(self, chat_id: Union[int, str], message_id: int, text :str, parse_mode=None, *args, **kwargs):
|
69
|
+
try:return await super().edit_message_text(chat_id=chat_id, message_id=message_id, text=get_font(text=text, font=self.font), parse_mode=ParseMode.HTML, *args, **kwargs)
|
70
|
+
except FloodWait as e:
|
71
|
+
await asyncio.sleep(e.value)
|
72
|
+
return await self.edit_message_text(chat_id=chat_id, message_id=message_id, text=get_font(text=text, font=self.font), parse_mode=ParseMode.HTML, *args, **kwargs)
|
73
|
+
|
74
|
+
async def edit_message_caption(self, chat_id :Union[int, str], message_id : int, caption :str, parse_mode=None, *args, **kwargs):
|
75
|
+
try:return await super().edit_message_caption(chat_id=chat_id, message_id=message_id, caption=get_font(text=caption, font=self.font), parse_mode=ParseMode.HTML, *args, **kwargs)
|
76
|
+
except FloodWait as e:
|
77
|
+
await asyncio.sleep(e.value)
|
78
|
+
return await self.edit_message_caption(chat_id=chat_id, message_id=message_id, caption=get_font(text=caption, font=self.font), parse_mode=ParseMode.HTML, *args, **kwargs)
|
79
|
+
|
80
|
+
async def edit_inline_text(self, inline_message_id: int, text :str, parse_mode=None, *args, **kwargs):
|
81
|
+
try:return await super().edit_inline_text(inline_message_id, text=get_font(text=text, font=self.font), parse_mode=ParseMode.HTML, *args, **kwargs)
|
82
|
+
except FloodWait as e:
|
83
|
+
await asyncio.sleep(e.value)
|
84
|
+
return await self.edit_inline_text(inline_message_id, text=get_font(text=text, font=self.font), parse_mode=ParseMode.HTML, *args, **kwargs)
|
85
|
+
|
86
|
+
async def send_document(self, chat_id :Union[int, str], document, caption :str=None, parse_mode=None, *args, **kwargs):
|
87
|
+
try:return await super().send_document(chat_id, document, caption=get_font(text=caption, font=self.font), parse_mode=ParseMode.HTML, *args, **kwargs)
|
88
|
+
except FloodWait as e:
|
89
|
+
await asyncio.sleep(e.value)
|
90
|
+
return await self.send_document(chat_id, document, caption=get_font(text=caption, font=self.font), parse_mode=ParseMode.HTML, *args, **kwargs)
|
91
|
+
|
92
|
+
async def send_video(self, chat_id :Union[int,str], video, caption :str=None, parse_mode=None, *args, **kwargs):
|
93
|
+
try:return await super().send_video(chat_id, video, caption=get_font(text=caption, font=self.font), parse_mode=ParseMode.HTML, *args, **kwargs)
|
94
|
+
except FloodWait as e:
|
95
|
+
await asyncio.sleep(e.value)
|
96
|
+
return await self.send_video(chat_id, video, caption=get_font(text=caption, font=self.font), parse_mode=ParseMode.HTML, *args, **kwargs)
|
97
|
+
|
98
|
+
async def send_audio(self, chat_id :Union[int,str], audio, caption :str=None, parse_mode=None, *args, **kwargs):
|
99
|
+
try:return await super().send_audio(chat_id, audio, caption=get_font(text=caption, font=self.font), parse_mode=ParseMode.HTML, *args, **kwargs)
|
100
|
+
except FloodWait as e:
|
101
|
+
await asyncio.sleep(e.value)
|
102
|
+
return await self.send_audio(chat_id, audio, caption=get_font(text=caption, font=self.font), parse_mode=ParseMode.HTML, *args, **kwargs)
|
103
|
+
|
104
|
+
async def send_voice(self, chat_id :Union[int,str], voice, caption :str=None, parse_mode=None, *args, **kwargs):
|
105
|
+
try:return await super().send_voice(chat_id, voice, caption=get_font(text=caption, font=self.font), parse_mode=ParseMode.HTML, *args, **kwargs)
|
106
|
+
except FloodWait as e:
|
107
|
+
await asyncio.sleep(e.value)
|
108
|
+
return await self.send_voice(chat_id, voice, caption=get_font(text=caption, font=self.font), parse_mode=ParseMode.HTML, *args, **kwargs)
|
109
|
+
|
110
|
+
async def send_alert(self,message:Union[Message,CallbackQuery], text :str):
|
111
|
+
if isinstance(message, Message):
|
112
|
+
return await message.reply(text)
|
113
|
+
elif isinstance(message, CallbackQuery):
|
114
|
+
return await message.answer(text, show_alert=True)
|
d4rktg-1.0.7/VERSION.txt
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
1.0.7
|
@@ -1,98 +0,0 @@
|
|
1
|
-
|
2
|
-
import pyrogram.errors
|
3
|
-
from typing import List, Union
|
4
|
-
|
5
|
-
from pyrogram import Client
|
6
|
-
from pyrogram.enums import ParseMode
|
7
|
-
from pyrogram.errors import FloodWait
|
8
|
-
from pyrogram.types import Message, CallbackQuery
|
9
|
-
|
10
|
-
from d4rk.Utils._fonts import get_font
|
11
|
-
from d4rk.Utils._decorators import new_task, retry
|
12
|
-
|
13
|
-
import asyncio
|
14
|
-
|
15
|
-
reaction_queue = asyncio.Queue()
|
16
|
-
semaphore = asyncio.Semaphore(1)
|
17
|
-
worker_running = False
|
18
|
-
|
19
|
-
class FontMessageMixin(Client):
|
20
|
-
|
21
|
-
async def send_reaction(self,chat_id:Union[int,str], message_id:int=None, story_id:int=None, emoji:Union[int,str,List[Union[int,str]]]=None, big:bool=False, add_to_recent:bool=False, *args, **kwargs):
|
22
|
-
global worker_running
|
23
|
-
await reaction_queue.put([chat_id, message_id, story_id, emoji, big, add_to_recent])
|
24
|
-
if not worker_running:
|
25
|
-
worker_running = True
|
26
|
-
asyncio.create_task(self.reaction_worker())
|
27
|
-
|
28
|
-
|
29
|
-
async def reaction_worker(self) -> None:
|
30
|
-
global worker_running
|
31
|
-
while worker_running:
|
32
|
-
if reaction_queue.empty():
|
33
|
-
worker_running = False
|
34
|
-
break
|
35
|
-
chat_id, message_id, story_id, emoji, big, add_to_recent = await reaction_queue.get()
|
36
|
-
async def job() -> None:
|
37
|
-
async with semaphore:
|
38
|
-
try:
|
39
|
-
await self._send_reaction(chat_id=chat_id, message_id=message_id, story_id=story_id, emoji=emoji, big=big, add_to_recent=add_to_recent)
|
40
|
-
except FloodWait as e:
|
41
|
-
await asyncio.sleep(e.value)
|
42
|
-
await self._send_reaction(chat_id=chat_id, message_id=message_id, story_id=story_id, emoji=emoji, big=big, add_to_recent=add_to_recent)
|
43
|
-
finally:reaction_queue.task_done()
|
44
|
-
await asyncio.sleep(5)
|
45
|
-
asyncio.create_task(job())
|
46
|
-
|
47
|
-
async def _send_reaction(self,*args, **kwargs):
|
48
|
-
print(args, kwargs)
|
49
|
-
return await super().send_reaction(*args, **kwargs)
|
50
|
-
|
51
|
-
@retry()
|
52
|
-
async def delete_message(self,chat_id:Union[int,str], message_ids:Union[int,List[int]], revoke:bool=True, wait: int = 0):
|
53
|
-
if wait > 0: await asyncio.sleep(wait)
|
54
|
-
try:await super().delete_messages(chat_id=chat_id, message_ids=message_ids, revoke=revoke)
|
55
|
-
except:pass
|
56
|
-
|
57
|
-
@retry()
|
58
|
-
async def send_message(self, chat_id :Union[int, str], text :str, parse_mode=None, *args, **kwargs):
|
59
|
-
return await super().send_message(chat_id=chat_id, text=get_font(text=text, font=self.font), parse_mode=ParseMode.HTML, *args, **kwargs)
|
60
|
-
|
61
|
-
@retry()
|
62
|
-
async def send_photo(self, chat_id:Union[int, str], photo :str, caption :str=None, parse_mode=None, *args, **kwargs):
|
63
|
-
return await super().send_photo(chat_id=chat_id, photo=photo, caption=get_font(text=caption, font=self.font), parse_mode=ParseMode.HTML, *args, **kwargs)
|
64
|
-
|
65
|
-
@retry()
|
66
|
-
async def edit_message_text(self, chat_id: Union[int, str], message_id: int, text :str, parse_mode=None, *args, **kwargs):
|
67
|
-
return await super().edit_message_text(chat_id=chat_id, message_id=message_id, text=get_font(text=text, font=self.font), parse_mode=ParseMode.HTML, *args, **kwargs)
|
68
|
-
|
69
|
-
@retry()
|
70
|
-
async def edit_message_caption(self, chat_id :Union[int, str], message_id : int, caption :str, parse_mode=None, *args, **kwargs):
|
71
|
-
return await super().edit_message_caption(chat_id=chat_id, message_id=message_id, caption=get_font(text=caption, font=self.font), parse_mode=ParseMode.HTML, *args, **kwargs)
|
72
|
-
|
73
|
-
@retry()
|
74
|
-
async def edit_inline_text(self, inline_message_id: int, text :str, parse_mode=None, *args, **kwargs):
|
75
|
-
return await super().edit_inline_text(inline_message_id, text=get_font(text=text, font=self.font), parse_mode=ParseMode.HTML, *args, **kwargs)
|
76
|
-
|
77
|
-
@retry()
|
78
|
-
async def send_document(self, chat_id :Union[int, str], document, caption :str=None, parse_mode=None, *args, **kwargs):
|
79
|
-
return await super().send_document(chat_id, document, caption=get_font(text=caption, font=self.font), parse_mode=ParseMode.HTML, *args, **kwargs)
|
80
|
-
|
81
|
-
@retry()
|
82
|
-
async def send_video(self, chat_id :Union[int,str], video, caption :str=None, parse_mode=None, *args, **kwargs):
|
83
|
-
return await super().send_video(chat_id, video, caption=get_font(text=caption, font=self.font), parse_mode=ParseMode.HTML, *args, **kwargs)
|
84
|
-
|
85
|
-
@retry()
|
86
|
-
async def send_audio(self, chat_id :Union[int,str], audio, caption :str=None, parse_mode=None, *args, **kwargs):
|
87
|
-
return await super().send_audio(chat_id, audio, caption=get_font(text=caption, font=self.font), parse_mode=ParseMode.HTML, *args, **kwargs)
|
88
|
-
|
89
|
-
@retry()
|
90
|
-
async def send_voice(self, chat_id :Union[int,str], voice, caption :str=None, parse_mode=None, *args, **kwargs):
|
91
|
-
return await super().send_voice(chat_id, voice, caption=get_font(text=caption, font=self.font), parse_mode=ParseMode.HTML, *args, **kwargs)
|
92
|
-
|
93
|
-
@retry()
|
94
|
-
async def send_alert(self,message:Union[Message,CallbackQuery], text :str):
|
95
|
-
if isinstance(message, Message):
|
96
|
-
return await message.reply(text)
|
97
|
-
elif isinstance(message, CallbackQuery):
|
98
|
-
return await message.answer(text, show_alert=True)
|
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
|