🐛 Fix audio media name

This commit is contained in:
xtaodada 2023-08-18 18:22:07 +08:00
parent 72421dd150
commit 39c726a8bc
Signed by: xtaodada
GPG Key ID: 4CBB3F4FA8C85659

View File

@ -224,7 +224,11 @@ async def audio_download(a: Audio, m: Message):
async with AsyncClient(headers=HEADERS, timeout=60) as client:
r = await client.get(download_url_data["cdns"][0])
media = BytesIO(r.content)
media.name = None
ext = download_url_data["cdns"][0].split("?")[0].split(".")[-1]
if ext:
media.name = f"{info['title']}.{ext}"
else:
media.name = f"{info['title']}.mp3"
media.seek(0)
if info.get("cover"):
r_ = await client.get(info.get("cover"))