txlyre 1 день назад
Родитель
Сommit
bd7536b428
1 измененных файлов с 17 добавлено и 4 удалено
  1. 17 4
      commands.py

+ 17 - 4
commands.py

@@ -1100,14 +1100,27 @@ mime_table = {
 
 
 async def wand_handler(bot, event, command):
-    if not event.document and not event.photo:
+    media = None
+    is_document = False
+
+    if event.photo:
+        media = event.photo
+    elif event.document:
+        media = event.document
+        is_document = True
+    elif event.reply:
+        if event.reply.photo:
+            media = event.reply.photo
+        elif event.document:
+            media = event.reply.document
+            is_document = True
+
+    if media is None:
         await event.reply("Требуется приложить фото или документ для обработки.")
 
         return
 
-    is_document = event.document is not None
-
-    image = await bot.download_media(event.photo or event.document, file=bytes)
+    image = await bot.download_media(media, file=bytes)
     program = command.args_string
 
     if program: