add duration info for local audio
This commit is contained in:
parent
2d5e9ce838
commit
135b90b32d
@ -109,16 +109,18 @@ async def play(c: Client, m: Message):
|
|||||||
suhu = await replied.reply("📥 **downloading audio...**")
|
suhu = await replied.reply("📥 **downloading audio...**")
|
||||||
dl = await replied.download()
|
dl = await replied.download()
|
||||||
link = replied.link
|
link = replied.link
|
||||||
if replied.audio:
|
|
||||||
if replied.audio.title:
|
try:
|
||||||
|
if replied.audio:
|
||||||
songname = replied.audio.title[:70]
|
songname = replied.audio.title[:70]
|
||||||
else:
|
songname = replied.audio.file_name[:70]
|
||||||
if replied.audio.file_name:
|
duration = replied.audio.duration
|
||||||
songname = replied.audio.file_name[:70]
|
elif replied.voice:
|
||||||
else:
|
songname = "Voice Note"
|
||||||
songname = "Audio"
|
duration = replied.voice.duration
|
||||||
elif replied.voice:
|
except BaseException:
|
||||||
songname = "Voice Note"
|
songname = "Audio"
|
||||||
|
|
||||||
if chat_id in QUEUE:
|
if chat_id in QUEUE:
|
||||||
pos = add_to_queue(chat_id, songname, dl, link, "Audio", 0)
|
pos = add_to_queue(chat_id, songname, dl, link, "Audio", 0)
|
||||||
requester = f"[{m.from_user.first_name}](tg://user?id={m.from_user.id})"
|
requester = f"[{m.from_user.first_name}](tg://user?id={m.from_user.id})"
|
||||||
@ -127,7 +129,7 @@ async def play(c: Client, m: Message):
|
|||||||
await m.reply_photo(
|
await m.reply_photo(
|
||||||
photo=f"{IMG_1}",
|
photo=f"{IMG_1}",
|
||||||
reply_markup=InlineKeyboardMarkup(buttons),
|
reply_markup=InlineKeyboardMarkup(buttons),
|
||||||
caption=f"💡 **Track added to queue »** `{pos}`\n\n🗂 **Name:** [{songname}]({link}) | `music`\n💭 **Chat:** `{chat_id}`\n🧸 **Request by:** {requester}",
|
caption=f"💡 **Track added to queue »** `{pos}`\n\n🗂 **Name:** [{songname}]({link}) | `music`\n⏱️ **Duration:** `{duration}`\n🧸 **Request by:** {requester}",
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
try:
|
try:
|
||||||
@ -146,7 +148,7 @@ async def play(c: Client, m: Message):
|
|||||||
await m.reply_photo(
|
await m.reply_photo(
|
||||||
photo=f"{IMG_2}",
|
photo=f"{IMG_2}",
|
||||||
reply_markup=InlineKeyboardMarkup(buttons),
|
reply_markup=InlineKeyboardMarkup(buttons),
|
||||||
caption=f"🗂 **Name:** [{songname}]({link}) | `music`\n💭 **Chat:** `{chat_id}`\n🧸 **Request by:** {requester}",
|
caption=f"🗂 **Name:** [{songname}]({link}) | `music`\n⏱️ **Duration:** `{duration}`\n🧸 **Request by:** {requester}",
|
||||||
)
|
)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
await suhu.delete()
|
await suhu.delete()
|
||||||
|
Loading…
Reference in New Issue
Block a user