[fix] a bug

This commit is contained in:
xtaodada 2022-02-16 21:49:50 +08:00
parent 865a1543fa
commit 058debb0b0
No known key found for this signature in database
GPG Key ID: EE4DC37B55E24736
2 changed files with 17 additions and 9 deletions

View File

@ -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.**" "» reply to an **audio file** or **give something to search.**"
) )
if replied.audio or replied.voice: if replied.audio or replied.voice:
if not link:
suhu = await replied.reply("📥 downloading audio...") suhu = await replied.reply("📥 downloading audio...")
else:
suhu = await m.reply("📥 downloading audio...")
dl = await replied.download() dl = await replied.download()
link = replied.link link = replied.link
songname = "Audio" songname = "Audio"
@ -86,7 +89,10 @@ async def play_tg_file(c: Client, m: Message, replied: Message = None, link: str
else: else:
songname = replied.audio.file_name[:80] songname = replied.audio.file_name[:80]
if replied.audio.thumbs: if replied.audio.thumbs:
if not link:
thumbnail = await c.download_media(replied.audio.thumbs[0].file_id) 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) duration = convert_seconds(replied.audio.duration)
elif replied.voice: elif replied.voice:
songname = "Voice Note" songname = "Voice Note"

View File

@ -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.**" "» reply to an **audio file** or **give something to search.**"
) )
if replied.video or replied.document: if replied.video or replied.document:
if not link:
loser = await replied.reply("📥 downloading video...") loser = await replied.reply("📥 downloading video...")
else:
loser = await m.reply("📥 downloading video...")
dl = await replied.download() dl = await replied.download()
link = replied.link link = replied.link
songname = "video" songname = "video"
duration = "00:00" duration = "00:00"
if len(m.command) < 2:
Q = 720 Q = 720
else: pq = m.text.split(None, 1)
pq = m.text.split(None, 1)[1] if ("t.me" not in m.text) and len(pq) > 1:
if pq == "720" or "480" or "360": pq = pq[1]
if pq == "720" or pq == "480" or pq == "360":
Q = int(pq) Q = int(pq)
else: else:
Q = 720
await loser.edit( await loser.edit(
"» only 720, 480, 360 allowed\n\n💡 now streaming video in **720p**" "» only 720, 480, 360 allowed\n\n💡 now streaming video in **720p**"
) )