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)
to_work = False
break
notify_in -= len(res)
for i in range(len(res)):
try:
# 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:
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 '''
try:
return await asyncio.to_thread(_get_all_qualities_raw, url, proxy, timeout)
except:
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 '''
try:
# no such quality cached
@@ -175,7 +175,7 @@ def _download_video_raw(url: str, quality_code : str, path: str, proxy: bool, ti
except:
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 '''
try:
return await asyncio.to_thread(_download_video_raw, url, quality_code, path, proxy, timeout)