From ddbd03dc1ea0fd26bbfc1159a46732b6e5faf402 Mon Sep 17 00:00:00 2001 From: Raven95676 Date: Mon, 24 Mar 2025 10:40:20 +0800 Subject: [PATCH] Adds sticker handling in Telegram adapter --- astrbot/core/platform/sources/telegram/tg_adapter.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/astrbot/core/platform/sources/telegram/tg_adapter.py b/astrbot/core/platform/sources/telegram/tg_adapter.py index 93ed6feb6..1b26e9ebe 100644 --- a/astrbot/core/platform/sources/telegram/tg_adapter.py +++ b/astrbot/core/platform/sources/telegram/tg_adapter.py @@ -199,6 +199,15 @@ class TelegramPlatformAdapter(Platform): ] message.message.append(Comp.At(qq=name, name=name)) + elif update.message.sticker: + # 将sticker当作图片处理 + file = await update.message.sticker.get_file() + message.message.append(Comp.Image(file=file.file_path, url=file.file_path)) + if update.message.sticker.emoji: + sticker_text = f"Sticker: {update.message.sticker.emoji}" + message.message_str = sticker_text + message.message.append(Comp.Plain(sticker_text)) + elif update.message.document: file = await update.message.document.get_file() message.message = [