Mods update

* Fixed notifications not working in mod_chat_sanitizer (in violent sanitization)
* Increased default timeouts for _get_all_quantites and _download_video (mod_video_downloader)
This commit is contained in:
2026-01-09 01:12:49 +03:00
parent 73cc8fdcbd
commit 5af7f3f646
2 changed files with 4 additions and 3 deletions

View File

@@ -98,6 +98,7 @@ async def _violent_worker(data: dict) -> None:
await client.send_message(report_peer, message='mod_chat_sanitizer:\n\nLooks like no new messages. Stopping... Offset: %s' % messages_offset) await client.send_message(report_peer, message='mod_chat_sanitizer:\n\nLooks like no new messages. Stopping... Offset: %s' % messages_offset)
to_work = False to_work = False
break break
notify_in -= len(res)
for i in range(len(res)): for i in range(len(res)):
try: try:
# check if text is forbidden # check if text is forbidden

View File

@@ -98,14 +98,14 @@ def _get_all_qualities_raw(url: str, proxy: bool, timeout: float = 20) -> dict |
except: except:
return traceback.format_exc() return traceback.format_exc()
async def _get_all_qualities(url: str, proxy: bool, timeout: float = 20) -> dict | str: async def _get_all_qualities(url: str, proxy: bool, timeout: float = 60) -> dict | str:
''' Async version ''' ''' Async version '''
try: try:
return await asyncio.to_thread(_get_all_qualities_raw, url, proxy, timeout) return await asyncio.to_thread(_get_all_qualities_raw, url, proxy, timeout)
except: except:
return traceback.format_exc() return traceback.format_exc()
def _download_video_raw(url: str, quality_code : str, path: str, proxy: bool, timeout: float = 20) -> str | bool: def _download_video_raw(url: str, quality_code : str, path: str, proxy: bool, timeout: float = 60) -> str | bool:
''' Download video from URL, use quality code to get info from cache ''' ''' Download video from URL, use quality code to get info from cache '''
try: try:
# no such quality cached # no such quality cached
@@ -175,7 +175,7 @@ def _download_video_raw(url: str, quality_code : str, path: str, proxy: bool, ti
except: except:
return traceback.format_exc() return traceback.format_exc()
async def _download_video(url: str, quality_code : str, path: str, proxy: bool, timeout: float = 20) -> str | bool: async def _download_video(url: str, quality_code : str, path: str, proxy: bool, timeout: float = 60) -> str | bool:
''' Async version ''' ''' Async version '''
try: try:
return await asyncio.to_thread(_download_video_raw, url, quality_code, path, proxy, timeout) return await asyncio.to_thread(_download_video_raw, url, quality_code, path, proxy, timeout)