Skip to content

Commit

Permalink
F* linter checks
Browse files Browse the repository at this point in the history
  • Loading branch information
AbhiTheModder committed Jun 1, 2024
1 parent 3b1fdca commit 55e2a08
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions modules/thumbnail.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import os
import imghdr
from PIL import Image

from pyrogram import Client, enums, filters
from pyrogram import Client, filters
from pyrogram.types import Message

from utils.misc import prefix, modules_help
Expand All @@ -14,9 +14,8 @@ async def setthumb(_, message: Message):
if not os.path.exists(THUMB_PATH):
os.makedirs(THUMB_PATH)
new_thumb = await message.reply_to_message.download()
type_thumb = imghdr.what(new_thumb)
if type_thumb:
if type_thumb in ["png", "jpg", "jpeg"]:
with Image.open(new_thumb) as img:
if img.format in ["PNG", "JPG", "JPEG"]:
new_path = os.path.join(THUMB_PATH, "thumb.jpg")
os.rename(new_thumb, new_path)
await message.edit_text("Thumbnail set successfully!")
Expand Down

0 comments on commit 55e2a08

Please sign in to comment.