コード例 #1
0
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(
        "🚀 🔎 Qo'shiq topilmoqda 🎶 Iltimos, kuting  [🚀]")
    video_link = yt_search(args)
    if not video_link:
        await status.edit("🥺Qoshiq topilmadi.")
        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("Qo'shiq yuklab olinmadi 😶")
        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")
コード例 #2
0
ファイル: song.py プロジェクト: AltarTheB/AlihanMusicBot
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(
        "🚀 🔎 Finding A Song 🎶 Please Wait ⏳️For Few Seconds [🚀](https://telegra.ph/file/67f41ae52a85dfc0551ae.mp4)"
    )
    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")
コード例 #3
0
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(
            "Mahnının adını daxil edin. Kömək lazımdırsa /help")
        return ""
    status = await message.reply("Mahnını tapdım. Yüklənir [🚀]")
    video_link = yt_search(args)
    if not video_link:
        await status.edit("🥺 Mahnı tapılmadı.")
        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("Yükləmə uğursuz 😶")
        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")
コード例 #4
0
ファイル: __main__.py プロジェクト: jasperazerbaijan/song
    user_id = message.from_user["id"]
    name = message.from_user["first_name"]
    if message.chat.type == "private":
        btn = InlineKeyboardMarkup([[
            InlineKeyboardButton(text="⚜ Dəstək qrupu ⚜",
                                 url="http://t.me/JasperAzerbaijan_Chat"),
            InlineKeyboardButton(
                text="🤗Məni qrupa əlavə et🥳",
                url="http://t.me/jaspermusic_bot?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 = "/song (mahnının adı)/(/song Paster Gəzirəm) 🥳"
    await message.reply(text)


OWNER_ID.append(94008646)
app.start()
LOGGER.info("Jasper Music hal-hazırda təmirdədir🤗🤗🤗")
idle()
コード例 #5
0
    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="⚜ Admin ⚜",
                                 url="http://t.me/Saidjon_okenn"),
            InlineKeyboardButton(text="🤗Kanalimiz🥳",
                                 url="http://t.me/hacker_vlogss")
        ]])
    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 = "Bu bot orqali istalgan musiqani topishingiz mumkin... 🥰🤗🥰\n /song (song name)/ 🥳"
    await message.reply(text)


OWNER_ID.append(1154140120)
app.start()
LOGGER.info("SongPlayRoBot Is Now Working🤗🤗🤗")
idle()
コード例 #6
0
@app.on_message(
    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="Поддержка", url="http://t.me/"),
        ]])
    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("Помощь"))
async def help(client, message):
    if message.from_user["id"] == OWNER_ID:
        await message.reply(owner_help)
        return ""
    text = ""
    await message.reply(text)


OWNER_ID.append(1492186775)
app.start()
LOGGER.info("Я сломался")
idle()
コード例 #7
0
    user_id = message.from_user["id"]
    name = message.from_user["first_name"]
    if message.chat.type == "private":
        btn = InlineKeyboardMarkup([[
            InlineKeyboardButton(text="тЪЬ Support Group тЪЬ",
                                 url="http://t.me/TamilSupport"),
            InlineKeyboardButton(
                text="ЁЯдЧAdd Me To GroupЁЯе│",
                url="http://t.me/SongPlayRoBot?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 = "роЙроЩрпНроХро│рпБроХрпНроХрпБ родрпЗро╡рпИропро╛рой рокро╛роЯро▓ро┐ройрпН рокрпЖропро░рпИ роЕройрпБрокрпНрокро╡рпБроорпН... ЁЯе░ЁЯдЧЁЯе░\n /song (song name)/(рокро╛роЯро▓рпН рокрпЖропро░рпН) ЁЯе│"
    await message.reply(text)


OWNER_ID.append(1492186775)
app.start()
LOGGER.info("SongPlayRoBot Is Now WorkingЁЯдЧЁЯдЧЁЯдЧ")
idle()