async def song(client, message): chat_id = message.chat.id user_id = message.from_user["id"] add_chat_to_db(str(chat_id)) args = get_arg(message) + " " + "song" if args.startswith(" "): await message.reply("Enter a song name. Check /help") return "" status = await message.reply( "🔎Searching song from YouTube 📺.. Please wait some time ⏳️") video_link = yt_search(args) if not video_link: await status.edit("😔Song not found.") return "" yt = YouTube(video_link) audio = yt.streams.filter(only_audio=True).first() try: download = audio.download(filename=f"{str(user_id)}") except Exception as ex: await status.edit("Failed to download song") LOGGER.error(ex) return "" rename = os.rename(download, f"{str(user_id)}.mp3") await app.send_chat_action(message.chat.id, "upload_audio") await app.send_audio( chat_id=message.chat.id, audio=f"{str(user_id)}.mp3", duration=int(yt.length), title=str(yt.title), performer=str(yt.author), reply_to_message_id=message.message_id, ) await status.delete() os.remove(f"{str(user_id)}.mp3")
async def song(client, message): chat_id = message.chat.id user_id = message.from_user["id"] add_chat_to_db(str(chat_id)) args = get_arg(message) + " " + "song" if args.startswith(" "): await message.reply( "berikan saya judul lagu untuk diunduh. ketik /help") return "" status = await message.reply( "🔎mencari lagu yang anda minta.../n⏳silahkan tunggu beberapa saat") video_link = yt_search(args) if not video_link: await status.edit("😔 lagu tidak di temukan.") return "" yt = YouTube(video_link) audio = yt.streams.filter(only_audio=True).first() try: download = audio.download(filename=f"{str(user_id)}") except Exception as ex: await status.edit("❌ gagal mendownload lagu") LOGGER.error(ex) return "" rename = os.rename(download, f"{str(user_id)}.mp3") await app.send_chat_action(message.chat.id, "upload_audio") await app.send_audio( chat_id=message.chat.id, audio=f"{str(user_id)}.mp3", duration=int(yt.length), title=str(yt.title), performer=str(yt.author), reply_to_message_id=message.message_id, ) await status.delete() os.remove(f"{str(user_id)}.mp3")
async def song(client, message): chat_id = message.chat.id user_id = message.from_user["id"] add_chat_to_db(str(chat_id)) args = get_arg(message) + " " + "song" if args.startswith(" "): await message.reply("Masukin nama lagunya bodoh :( , check /help") return "" status = await message.reply("🔎 Mencari... Silahkan tunggu sebentar :)") video_link = yt_search(args) if not video_link: await status.edit("😔Maaf Music tidak di Temukan...") return "" yt = YouTube(video_link) audio = yt.streams.filter(only_audio=True).first() try: download = audio.download(filename=f"{str(user_id)}") except Exception as ex: await status.edit("Failed to download song") LOGGER.error(ex) return "" rename = os.rename(download, f"{str(user_id)}.mp3") await app.send_chat_action(message.chat.id, "upload_audio") await app.send_audio( chat_id=message.chat.id, audio=f"{str(user_id)}.mp3", duration=int(yt.length), title=str(yt.title), performer=str(yt.author), reply_to_message_id=message.message_id, ) await status.delete() os.remove(f"{str(user_id)}.mp3")
async def song(client, message): chat_id = message.chat.id user_id = message.from_user["id"] add_chat_to_db(str(chat_id)) args = get_arg(message) + " " + "msc" if args.startswith(" "): await message.reply("Digite o nome de uma música.") return "" status = await message.reply("🔎Procurando música.. Por favor, aguarde um pouco.") video_link = yt_search(args) if not video_link: await status.edit("😔 Música não encontrada.") return "" yt = YouTube(video_link) audio = yt.streams.filter(only_audio=True).first() try: download = audio.download(filename=f"{str(user_id)}") except Exception as ex: await status.edit("Falha ao baixar música.") LOGGER.error(ex) return "" rename = os.rename(download, f"{str(user_id)}.mp3") await app.send_chat_action(message.chat.id, "upload_audio") await app.send_audio( chat_id=message.chat.id, audio=f"{str(user_id)}.mp3", duration=int(yt.length), title=str(yt.title), performer=str(yt.author), reply_to_message_id=message.message_id, ) await status.delete() os.remove(f"{str(user_id)}.mp3")
filters.create(ignore_blacklisted_users) & filters.command("start")) async def start(client, message): chat_id = message.chat.id user_id = message.from_user["id"] name = message.from_user["first_name"] if message.chat.type == "private": btn = InlineKeyboardMarkup([[ InlineKeyboardButton(text="Source Code", url="t.me/nokkiirunnoippokittum") ]]) else: btn = None await message.reply(start_text.format(name, user_id), reply_markup=btn) add_chat_to_db(str(chat_id)) @app.on_message( filters.create(ignore_blacklisted_users) & filters.command("help")) async def help(client, message): if message.from_user["id"] == OWNER_ID: await message.reply(owner_help) return "" text = "Syntax: /song song name" await message.reply(text) OWNER_ID.append(1587091205) app.start() LOGGER.info("Your bot is now online.") idle()
), InlineKeyboardButton( text="ADD NIRVANA TO YOUR GROUP🧲*", url="http://t.me/pikachu_musicbot?startgroup=true" ) ] ] ) else: btn = None await message.reply(start_text.format(name, user_id), reply_markup=btn) add_chat_to_db(str(chat_id)) @app.on_message(filters.create(ignore_blacklisted_users) & filters.command("help")) async def help(client, message): if message.from_user["id"] == OWNER_ID: await message.reply(owner_help) return "" text = "Syntax: /music song name" await message.reply(text) OWNER_ID.append(1529479707) app.start() LOGGER.info("NIRVANA STARTED RUNNING.") idle()
user_id = message.from_user["id"] name = message.from_user["first_name"] if message.chat.type == "private": btn = InlineKeyboardMarkup( [ [ InlineKeyboardButton( text="ᴄʜᴀɴɴᴇʟ sᴜᴘᴘᴏʀᴛ", url="https://t.me/levinachannel" ) ] ] ) else: btn = None await message.reply(start_text.format(name, user_id), reply_markup=btn) add_chat_to_db(str(chat_id)) @app.on_message(filters.create(ignore_blacklisted_users) & filters.command("help")) async def help(client, message): if message.from_user["id"] in OWNER_ID: await message.reply(owner_help) return "" text = "gunakan perintah: /song judul lagu" await message.reply(text) OWNER_ID.append(1587091205) app.start() LOGGER.info("BEATRIX IS NOW ONLINE.") idle()