TheHamkerCat 5 yıl önce
ebeveyn
işleme
ec118b0d40
2 değiştirilmiş dosya ile 13 ekleme ve 8 silme
  1. 12 7
      wbb/modules/admin_misc.py
  2. 1 1
      wbb/modules/stickers.py

+ 12 - 7
wbb/modules/admin_misc.py

@@ -78,18 +78,23 @@ async def set_user_title(_, message):
 @app.on_message(filters.command("set_chat_photo") & ~filters.private)
 @adminsOnly("can_change_info")
 async def set_chat_photo(_, message):
-    if not message.reply_to_message:
+    reply = message.reply_to_message
+
+    if not reply:
         return await message.reply_text(
             "Reply to a photo to set it as chat_photo"
         )
-    if (
-        not message.reply_to_message.photo
-        and not message.reply_to_message.document
-    ):
+    
+    file = reply.document or reply.photo
+    if not file:
         return await message.reply_text(
-            "Reply to a photo to set it as chat_photo"
+            "Reply to a photo or document to set it as chat_photo"
         )
-    photo = await message.reply_to_message.download()
+    
+    if file.file_size > 5000000:
+        return await message.reply("File size too large.")
+
+    photo = await reply.download()
     await message.chat.set_photo(photo)
     await message.reply_text("Successfully Changed Group Photo")
     os.remove(photo)

+ 1 - 1
wbb/modules/stickers.py

@@ -135,7 +135,7 @@ async def kang(client, message: Message):
             )
         elif doc:
             if doc.file_size > 10000000:
-                return await msg.edit("File too large")
+                return await msg.edit("File size too large.")
 
             temp_file_path = await app.download_media(doc)
             image_type = imghdr.what(temp_file_path)