From a1197415f368d713c9ace8f1966cebdd47d2109f Mon Sep 17 00:00:00 2001 From: yym68686 Date: Wed, 26 Jun 2024 19:25:46 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Bug:=20Fix=20the=20bug=20where?= =?UTF-8?q?=20caption=20images=20cannot=20be=20recognized.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 💻 Code: Set the Docker image tag to latest --- .github/workflows/main.yml | 2 +- bot.py | 17 +++++++++-------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 42f20af9..2a716e36 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -37,4 +37,4 @@ jobs: file: Dockerfile.build platforms: linux/amd64,linux/arm64 push: true - tags: yym68686/chatgpt:1.0 \ No newline at end of file + tags: yym68686/chatgpt:lastest \ No newline at end of file diff --git a/bot.py b/bot.py index 446e2e67..64a1e070 100644 --- a/bot.py +++ b/bot.py @@ -123,22 +123,23 @@ async def GetMesage(update_message, context): reply_to_message_file_url = await get_file_url(reply_to_message_file, context) reply_to_message_file_content = Document_extract(reply_to_message_file_url, reply_to_message_file_url, None) + if update_message.photo: + photo = update_message.photo[-1] + + image_url = await get_file_url(photo, context) + + if update_message.caption: + message = rawtext = CutNICK(update_message.caption, update_message) + if update_message.document: file = update_message.document file_url = await get_file_url(file, context) - message = rawtext = CutNICK(update_message.caption, update_message) - - if update_message.photo: - photo = update_message.photo[-1] - - image_url = await get_file_url(photo, context) if image_url == None and file_url and (file_url[-3:] == "jpg" or file_url[-3:] == "png" or file_url[-4:] == "jpeg"): image_url = file_url - if update_message.caption: - message = rawtext = CutNICK(update_message.caption, update_message) + message = rawtext = CutNICK(update_message.caption, update_message) return message, rawtext, image_url, chatid, messageid, reply_to_message_text, message_thread_id, convo_id, file_url, reply_to_message_file_content