From a93093ea806e76d06ace1f179d75d48040ce4fee Mon Sep 17 00:00:00 2001 From: xtaodada Date: Fri, 18 Aug 2023 18:25:33 +0800 Subject: [PATCH] =?UTF-8?q?:zap:=20=E4=BC=98=E5=8C=96=20audio=20caption?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- defs/bilibili_download.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/defs/bilibili_download.py b/defs/bilibili_download.py index eb633e1..b5b5f1e 100644 --- a/defs/bilibili_download.py +++ b/defs/bilibili_download.py @@ -236,9 +236,13 @@ async def audio_download(a: Audio, m: Message): thumb.seek(0) else: thumb = None - text = f"{info['title']}\n\n{info.get('desc', '')}\n\nhttps://www.bilibili.com/audio/au{a.get_auid()}" - if len(text) > 800: - text = f"{info['title']}\n\n简介过长,无法显示\n\nhttps://www.bilibili.com/audio/au{a.get_auid()}" + intro = info.get("intro", "") + if intro: + text = f"{info['title']}\n\n{intro}\n\nhttps://www.bilibili.com/audio/au{a.get_auid()}" + if len(text) > 800: + text = f"{info['title']}\n\n简介过长,无法显示\n\nhttps://www.bilibili.com/audio/au{a.get_auid()}" + else: + text = f"{info['title']}\n\nhttps://www.bilibili.com/audio/au{a.get_auid()}" await bot.send_audio( chat_id=m.chat.id, audio=media, @@ -246,6 +250,7 @@ async def audio_download(a: Audio, m: Message): parse_mode=ParseMode.HTML, reply_to_message_id=m.reply_to_message_id, thumb=thumb, + title=info.get("title"), duration=info.get("duration"), performer=info.get("author"), )