[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.**"
)
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"

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.**"
)
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**"
)