Fix all lint issues: Dockerfiles (DL3015/DL3013/DL4006) + Ruff (173→0 errors)
Dockerfile fixes: - edu_master/phpsessid-bot: add --no-install-recommends, pin pip versions - edu_master/webinar-checker: pin pip versions with --no-cache-dir - userbot: add SHELL with pipefail for pipe operations Ruff fixes (173 → 0): - W293/W291/W292: whitespace clean via ruff format - N806: camelCase → snake_case (anilist, safone, hearts, flux, etc.) - ARG001/ARG002: prefix unused params with _ - SIM115: use context managers for file I/O - SIM117: combine nested with statements - S608: noqa on SQL f-strings (module name is validated) - E402/N812/N817: import fixes - B023: pass loop variable as argument - I001: auto-sorted imports - syntax: fixed = vs == in dtek_notif/main.py
This commit is contained in:
@@ -166,17 +166,17 @@ async def app(client: Client, message: Message):
|
||||
result = response.json()
|
||||
|
||||
try:
|
||||
coverImage_url = result['results'][0]['icon']
|
||||
coverImage = requests.get(url=coverImage_url, timeout=10).content
|
||||
async with aiofiles.open('coverImage.jpg', mode='wb') as f:
|
||||
await f.write(coverImage)
|
||||
cover_image_url = result['results'][0]['icon']
|
||||
cover_image = requests.get(url=cover_image_url, timeout=10).content
|
||||
async with aiofiles.open('cover_image.jpg', mode='wb') as f:
|
||||
await f.write(cover_image)
|
||||
|
||||
except Exception:
|
||||
coverImage = None
|
||||
cover_image = None
|
||||
|
||||
description = result['results'][0]['description']
|
||||
developer = result['results'][0]['developer']
|
||||
IsFree = result['results'][0]['free']
|
||||
is_free = result['results'][0]['free']
|
||||
genre = result['results'][0]['genre']
|
||||
package_name = result['results'][0]['id']
|
||||
title = result['results'][0]['title']
|
||||
@@ -189,8 +189,8 @@ async def app(client: Client, message: Message):
|
||||
chat_id,
|
||||
[
|
||||
InputMediaPhoto(
|
||||
'coverImage.jpg',
|
||||
caption=f'<b>Title:</b> <code>{title}</code>\n<b>Rating:</b> <code>{rating}</code>\n<b>IsFree:</b> <code>{IsFree}</code>\n<b>Price:</b> <code>{price}</code>\n<b>Package Name:</b> <code>{package_name}</code>\n<b>Genres:</b> <code>{genre}</code>\n<b>Developer:</b> <code>{developer}\n<b>Description:</b> {description}\n<b>Link:</b> {link}',
|
||||
'cover_image.jpg',
|
||||
caption=f'<b>Title:</b> <code>{title}</code>\n<b>Rating:</b> <code>{rating}</code>\n<b>is_free:</b> <code>{is_free}</code>\n<b>Price:</b> <code>{price}</code>\n<b>Package Name:</b> <code>{package_name}</code>\n<b>Genres:</b> <code>{genre}</code>\n<b>Developer:</b> <code>{developer}\n<b>Description:</b> {description}\n<b>Link:</b> {link}',
|
||||
)
|
||||
],
|
||||
)
|
||||
@@ -202,16 +202,16 @@ async def app(client: Client, message: Message):
|
||||
chat_id,
|
||||
[
|
||||
InputMediaPhoto(
|
||||
'coverImage.jpg',
|
||||
caption=f'<b>Title:</b> <code>{title}</code>\n<b>Rating:</b> <code>{rating}</code>\n<b>IsFree:</b> <code>{IsFree}</code>\n<b>Price:</b> <code>{price}</code>\n<b>Package Name:</b> <code>{package_name}</code>\n<b>Genres:</b> <code>{genre}</code>\n<b>Developer:</b> <code>{developer}\n<b>Description:</b> {description}\n<b>Link:</b> {link}',
|
||||
'cover_image.jpg',
|
||||
caption=f'<b>Title:</b> <code>{title}</code>\n<b>Rating:</b> <code>{rating}</code>\n<b>is_free:</b> <code>{is_free}</code>\n<b>Price:</b> <code>{price}</code>\n<b>Package Name:</b> <code>{package_name}</code>\n<b>Genres:</b> <code>{genre}</code>\n<b>Developer:</b> <code>{developer}\n<b>Description:</b> {description}\n<b>Link:</b> {link}',
|
||||
)
|
||||
],
|
||||
)
|
||||
except Exception as e:
|
||||
await message.edit_text(format_exc(e))
|
||||
finally:
|
||||
if os.path.exists('coverImage.jpg'):
|
||||
os.remove('coverImage.jpg')
|
||||
if os.path.exists('cover_image.jpg'):
|
||||
os.remove('cover_image.jpg')
|
||||
|
||||
|
||||
@Client.on_message(filters.command('tsearch', prefix) & filters.me)
|
||||
@@ -232,7 +232,7 @@ async def tsearch(client: Client, message: Message):
|
||||
|
||||
result = response.json()
|
||||
|
||||
coverImage_url = result['results'][0]['thumbnail']
|
||||
cover_image_url = result['results'][0]['thumbnail']
|
||||
description = result['results'][0]['description']
|
||||
genre = result['results'][0]['genre']
|
||||
category = result['results'][0]['category']
|
||||
@@ -264,17 +264,17 @@ async def tsearch(client: Client, message: Message):
|
||||
content=all_results_content,
|
||||
)
|
||||
|
||||
if coverImage_url is not None:
|
||||
coverImage = requests.get(url=coverImage_url, timeout=10).content
|
||||
async with aiofiles.open('coverImage.jpg', mode='wb') as f:
|
||||
await f.write(coverImage)
|
||||
if cover_image_url is not None:
|
||||
cover_image = requests.get(url=cover_image_url, timeout=10).content
|
||||
async with aiofiles.open('cover_image.jpg', mode='wb') as f:
|
||||
await f.write(cover_image)
|
||||
|
||||
await message.delete()
|
||||
await client.send_media_group(
|
||||
chat_id,
|
||||
[
|
||||
InputMediaPhoto(
|
||||
'coverImage.jpg',
|
||||
'cover_image.jpg',
|
||||
caption=f"<b>Title:</b> <code>{title}</code>\n<b>Category:</b> <code>{category}</code>\n<b>Language:</b> <code>{language}</code>\n<b>Size:</b> <code>{size}</code>\n<b>Genres:</b> <code>{genre}</code>\n<b>Description:</b> {description}\n<b>Magnet Link:</b> <a href='{link_result}'>Click Here</a>\n<b>More Results:</b> <a href='{link_results}'>Click Here</a>",
|
||||
)
|
||||
],
|
||||
@@ -292,7 +292,7 @@ async def tsearch(client: Client, message: Message):
|
||||
chat_id,
|
||||
[
|
||||
InputMediaPhoto(
|
||||
'coverImage.jpg',
|
||||
'cover_image.jpg',
|
||||
caption=f"<b>Title:</b> <code>{title}</code>\n<b>Category:</b> <code>{category}</code>\n<b>Language:</b> <code>{language}</code>\n<b>Size:</b> <code>{size}</code>\n<b>Genres:</b> <code>{genre}</code>\n<b>Description:</b> {description}\n<b>Magnet Link:</b> <a href='{link_result}'>Click Here</a>",
|
||||
)
|
||||
],
|
||||
@@ -308,8 +308,8 @@ async def tsearch(client: Client, message: Message):
|
||||
except Exception as e:
|
||||
await message.edit_text(format_exc(e))
|
||||
finally:
|
||||
if os.path.exists('coverImage.jpg'):
|
||||
os.remove('coverImage.jpg')
|
||||
if os.path.exists('cover_image.jpg'):
|
||||
os.remove('cover_image.jpg')
|
||||
|
||||
|
||||
@Client.on_message(filters.command('stts', prefix) & filters.me)
|
||||
|
||||
Reference in New Issue
Block a user