From 058debb0b04f8cbe9039d672891c2cb902161c09 Mon Sep 17 00:00:00 2001 From: xtaodada Date: Wed, 16 Feb 2022 21:49:50 +0800 Subject: [PATCH] [fix] a bug --- program/music.py | 10 ++++++++-- program/video.py | 16 +++++++++------- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/program/music.py b/program/music.py index 8a802aa..03bd19f 100644 --- a/program/music.py +++ b/program/music.py @@ -73,7 +73,10 @@ async def play_tg_file(c: Client, m: Message, replied: Message = None, link: str "Ā» reply to an **audio file** or **give something to search.**" ) if replied.audio or replied.voice: - suhu = await replied.reply("šŸ“„ downloading audio...") + if not link: + suhu = await replied.reply("šŸ“„ downloading audio...") + else: + suhu = await m.reply("šŸ“„ downloading audio...") dl = await replied.download() link = replied.link songname = "Audio" @@ -86,7 +89,10 @@ async def play_tg_file(c: Client, m: Message, replied: Message = None, link: str else: songname = replied.audio.file_name[:80] if replied.audio.thumbs: - thumbnail = await c.download_media(replied.audio.thumbs[0].file_id) + if not link: + thumbnail = await c.download_media(replied.audio.thumbs[0].file_id) + else: + thumbnail = await user.download_media(replied.audio.thumbs[0].file_id) duration = convert_seconds(replied.audio.duration) elif replied.voice: songname = "Voice Note" diff --git a/program/video.py b/program/video.py index 4e20fe9..17e49bb 100644 --- a/program/video.py +++ b/program/video.py @@ -89,19 +89,21 @@ async def play_tg_file(c: Client, m: Message, replied: Message = None, link: str "Ā» reply to an **audio file** or **give something to search.**" ) if replied.video or replied.document: - loser = await replied.reply("šŸ“„ downloading video...") + if not link: + loser = await replied.reply("šŸ“„ downloading video...") + else: + loser = await m.reply("šŸ“„ downloading video...") dl = await replied.download() link = replied.link songname = "video" duration = "00:00" - if len(m.command) < 2: - Q = 720 - else: - pq = m.text.split(None, 1)[1] - if pq == "720" or "480" or "360": + Q = 720 + pq = m.text.split(None, 1) + if ("t.me" not in m.text) and len(pq) > 1: + pq = pq[1] + if pq == "720" or pq == "480" or pq == "360": Q = int(pq) else: - Q = 720 await loser.edit( "Ā» only 720, 480, 360 allowed\n\nšŸ’” now streaming video in **720p**" )