|
|
@@ -6,6 +6,10 @@ from wbb import app, Command
|
|
|
import os
|
|
|
import glob
|
|
|
|
|
|
+__MODULE__ = "Music"
|
|
|
+__HELP__ = "/music [link] To Download Music From Various Websites"
|
|
|
+
|
|
|
+
|
|
|
ydl_opts = {
|
|
|
'format': 'bestaudio/best',
|
|
|
'postprocessors': [{
|
|
|
@@ -23,14 +27,16 @@ ydl_opts = {
|
|
|
@app.on_message(cust_filter.command(commands=(["music"])))
|
|
|
async def commit(client, message):
|
|
|
app.set_parse_mode("markdown")
|
|
|
- await message.reply_chat_action("upload_audio")
|
|
|
+ down = await message.reply_text("```Downloading Media!```")
|
|
|
link = (message.text.split(None, 1)[1])
|
|
|
with youtube_dl.YoutubeDL(ydl_opts) as ydl:
|
|
|
ydl.download([link])
|
|
|
for filename in glob.glob("*.mp3"):
|
|
|
filename_final = filename.split("-")[0]+" - "+filename.split("-")[-2]+".mp3"
|
|
|
os.rename(filename, filename_final)
|
|
|
+ await down.edit(f"```Uploading Media!```")
|
|
|
m = await message.reply_audio(filename_final)
|
|
|
+ await down.delete()
|
|
|
await m.edit_caption(f"[{filename_final}]({link})")
|
|
|
os.remove(filename_final)
|
|
|
|