From 2f4f237810b44967e4cfa7cb2e6bc0524b83727c Mon Sep 17 00:00:00 2001 From: Soulter <905617992@qq.com> Date: Wed, 12 Mar 2025 14:14:45 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix:=20=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E9=83=A8=E5=88=86=E6=83=85=E5=86=B5=E4=B8=8B=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E6=97=A0=E6=B3=95=E4=B8=8A=E4=BC=A0=E5=88=B0=20Telegram=20?= =?UTF-8?q?=E7=BE=A4=E7=BB=84=E7=9A=84=E9=97=AE=E9=A2=98=20#601?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- astrbot/core/platform/sources/telegram/tg_event.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/astrbot/core/platform/sources/telegram/tg_event.py b/astrbot/core/platform/sources/telegram/tg_event.py index de0f9a58e..7708732b4 100644 --- a/astrbot/core/platform/sources/telegram/tg_event.py +++ b/astrbot/core/platform/sources/telegram/tg_event.py @@ -2,6 +2,7 @@ from astrbot.api.event import AstrMessageEvent, MessageChain from astrbot.api.platform import AstrBotMessage, PlatformMetadata, MessageType from astrbot.api.message_components import Plain, Image, Reply, At, File, Record from telegram.ext import ExtBot +from astrbot.core.utils.io import download_file class TelegramPlatformEvent(AstrMessageEvent): @@ -58,6 +59,11 @@ class TelegramPlatformEvent(AstrMessageEvent): else: await client.send_photo(photo=image_path, **payload) elif isinstance(i, File): + if i.file.startswith("https://"): + path = "data/temp/" + i.name + await download_file(i.file, path) + i.file = path + await client.send_document(document=i.file, filename=i.name, **payload) elif isinstance(i, Record): await client.send_voice(voice=i.file, **payload)