コード例 #1
0
async def play(_, message: Message):
    audio = (message.reply_to_message.audio or message.reply_to_message.voice) if message.reply_to_message else None
    url = get_url(message)

    if audio:
        if round(audio.duration / 60) > DURATION_LIMIT:
            raise DurationLimitError(
                f"**{bn} :-** 😕 Daha uzun videolar {DURATION_LIMIT} minute(s) buna izin verilmiyor!\n🤐 Sağlanan video, {audio.duration / 60} Dakika(s)"
            )

        file_name = get_file_name(audio)
        file_path = await converter.convert(
            (await message.reply_to_message.download(file_name))
            if not path.isfile(path.join("downloads", file_name)) else file_name
        )
    elif url:
        file_path = await converter.convert(youtube.download(url))
    else:
        return await message.reply_text(f"**{bn} :-** 🙄 Bana oynatılacak bir şey vermedin.!")

    if message.chat.id in callsmusic.pytgcalls.active_calls:
        await message.reply_text(f"**{bn} :-** 😉 sıraya alındı #{await callsmusic.queues.put(message.chat.id, file_path=file_path)} !")
    else:
        callsmusic.pytgcalls.join_group_call(message.chat.id, file_path)
        await message.reply_text(f"**{bn} :-** 🥳 Çalınıyor...")
コード例 #2
0
async def loop(_, message: Message):
    audio = (message.reply_to_message.audio or message.reply_to_message.voice
             ) if message.reply_to_message else None
    url = get_url(message)

    if audio:
        if round(audio.duration / 60) > DURATION_LIMIT:
            raise DurationLimitError(
                f"**{bn} :-** 😕 Videos longer than {DURATION_LIMIT} minute(s) aren't allowed!\n🤐 The provided video is {audio.duration / 60} minute(s)"
            )

        file_name = get_file_name(audio)
        file_path = await converter.convert((
            await message.reply_to_message.download(file_name)
        ) if not path.isfile(path.join("downloads", file_name)) else file_name)
    elif url:
        file_path = await converter.convert(youtube.download(url))
    else:
        return await message.reply_text(
            f"**{bn} :-** 🙄 BSDK KUCH DE TOH SAHI PLAY KRRNE KO!")

    if message.chat.id in callsmusic.pytgcalls.active_calls:
        await message.reply_text(
            f"**{bn} :-** 😉 is gaane k baad 3 baar bajaunga #{await callsmusic.queues.put(message.chat.id, file_path=file_path)}!"
        )
        await callsmusic.queues.put(message.chat.id, file_path=file_path)
        await callsmusic.queues.put(message.chat.id, file_path=file_path)
    else:
        callsmusic.pytgcalls.join_group_call(message.chat.id, file_path)
        await message.reply_text(f"**{bn} :-** 🥳 OK BHAI BAJATA HU 3 baar")
    await callsmusic.queues.put(message.chat.id, file_path=file_path)
    await callsmusic.queues.put(message.chat.id, file_path=file_path)
コード例 #3
0
async def play(_, message: Message):
    audio = (message.reply_to_message.audio or message.reply_to_message.voice
             ) if message.reply_to_message else None
    url = get_url(message)
    if audio:
        if round(audio.duration / 100) > DURATION_LIMIT:
            raise DurationLimitError(
                f"**{bn} :-**  يجب ان يكون حجم مقطع الصوت  {DURATION_LIMIT} minute(s) لايمكن تحميل \n المقطع هذا لان حجمه {audio.duration / 100} minute(s)"
            )

        file_name = get_file_name(audio)
        file_path = await converter.convert((
            await message.reply_to_message.download(file_name)
        ) if not path.isfile(path.join("downloads", file_name)) else file_name)
    elif url:
        file_path = await converter.convert(youtube.download(url))
    else:
        return await message.reply_text(
            f"**{bn} :-** قم بالرد على الاغنيه او الرابط اولا ♻️")

    if message.chat.id in callsmusic.pytgcalls.active_calls:
        await message.reply_text(
            f"**{bn} :-** تم اضافه الاغنيه الى الدور #{await callsmusic.queues.put(message.chat.id, file_path=file_path)} 🎶"
        )
    else:
        callsmusic.pytgcalls.join_group_call(message.chat.id, file_path)
        await message.reply_text(f"**{bn} :-** تم تشغيل الاغنيه.. 🎶")
コード例 #4
0
ファイル: play.py プロジェクト: cancinconntg/vc_bot
async def oynat(_, message: Message):
    audio = (message.reply_to_message.audio or message.reply_to_message.voice
             ) if message.reply_to_message else None
    url = get_url(message)

    if audio:
        if round(audio.duration / 60) > DURATION_LIMIT:
            raise DurationLimitError(
                f"**{bn} :-** 😕 Ses Dosyası Uzun {DURATION_LIMIT} minute(s) izin verilmez!\n🤐 Sağlanan ses, {audio.duration / 60} minute(s)"
            )

        file_name = get_file_name(audio)
        file_path = await converter.convert((
            await message.reply_to_message.download(file_name)
        ) if not path.isfile(path.join("downloads", file_name)) else file_name)
    elif url:
        file_path = await converter.convert(youtube.download(url))
    else:
        return await message.reply_text(
            f"**{bn} :-** 🙄 Bana oynatacak bir şey vermedin.!")

    if message.chat.id in callsmusic.pytgcalls.active_calls:
        await message.reply_text(
            f"**{bn} :-** 😉 Sıraya Alındı. Sırası= #{await callsmusic.queues.put(message.chat.id, file_path=file_path)} !"
        )
    else:
        callsmusic.pytgcalls.join_group_call(message.chat.id, file_path)
        await message.reply_text(f"**{bn} :-** 🥳 Oynatılıyor...")
コード例 #5
0
ファイル: play.py プロジェクト: dangerbots/tg-music
async def play(_, message: Message):
    audio = (message.reply_to_message.audio or message.reply_to_message.voice
             ) if message.reply_to_message else None
    url = get_url(message)

    if audio:
        if round(audio.duration / 60) > DURATION_LIMIT:
            raise DurationLimitError(
                f"**{bn} :-**VIDEO IS LONGERTHAN {DURATION_LIMIT} minute(s) \n THE VIDEO U GIVEN IS {audio.duration / 60} MINUTES(s)"
            )

        file_name = get_file_name(audio)
        file_path = await converter.convert((
            await message.reply_to_message.download(file_name)
        ) if not path.isfile(path.join("downloads", file_name)) else file_name)
    elif url:
        file_path = await converter.convert(youtube.download(url))
    else:
        return await message.reply_text(
            f"**{bn} :-** GIVE ME SOMETHING TO PLAY")

    if message.chat.id in callsmusic.pytgcalls.active_calls:
        await message.reply_text(
            f"**{bn} :-**[★](https://telegra.ph/file/8659dbdff98d2f4512b1f.jpg) QUEUED AT  #{await callsmusic.queues.put(message.chat.id, file_path=file_path)}!"
        )
    else:
        callsmusic.pytgcalls.join_group_call(message.chat.id, file_path)
        await message.reply_text(
            f"**{bn} :-**PLAYING [★](https://telegra.ph/file/8659dbdff98d2f4512b1f.jpg)"
        )
コード例 #6
0
ファイル: play.py プロジェクト: perdincapt/callsmusic-2
async def play(_, message: Message):
    audio = (message.reply_to_message.audio or message.reply_to_message.voice
             ) if message.reply_to_message else None
    url = get_url(message)

    if audio:
        if round(audio.duration / 60) > DURATION_LIMIT:
            raise DurationLimitError(
                f"Videos longer than {DURATION_LIMIT} minute(s) aren't allowed, the provided video is {audio.duration / 60} minute(s)"
            )

        file_name = get_file_name(audio)
        file_path = await converter.convert((
            await message.reply_to_message.download(file_name)
        ) if not path.isfile(path.join("downloads", file_name)) else file_name)
    elif url:
        file_path = await converter.convert(youtube.download(url))
    else:
        return await message.reply_text("You did not give me anything to play!"
                                        )

    if message.chat.id in callsmusic.pytgcalls.active_calls:
        await message.reply_text(
            f"Queued at position {await callsmusic.queues.put(message.chat.id, file_path=file_path)}!"
        )
    else:
        callsmusic.pytgcalls.join_group_call(message.chat.id, file_path)
        await message.reply_text("Playing...")
コード例 #7
0
ファイル: play.py プロジェクト: AhmadAlbaron/MusicBot
async def play(_, message: Message):
    audio = (message.reply_to_message.audio or message.reply_to_message.voice
             ) if message.reply_to_message else None
    url = get_url(message)
    if audio:
        if round(audio.duration / 100) > DURATION_LIMIT:
            raise DurationLimitError(
                f"**{bn} :-**  ببوورە قەبارەی زۆرە  {DURATION_LIMIT} minute(s) ناتوانم دابگرم \n نابێ لە زیاتر بێ {audio.duration / 100} minute(s)"
            )

        file_name = get_file_name(audio)
        file_path = await converter.convert((
            await message.reply_to_message.download(file_name)
        ) if not path.isfile(path.join("downloads", file_name)) else file_name)
    elif url:
        file_path = await converter.convert(youtube.download(url))
    else:
        return await message.reply_text(
            f"**{bn} :-** تکایە لە ڕێپڵەی گۆرانی یان لینک بنوسە ♻️")

    if message.chat.id in callsmusic.pytgcalls.active_calls:
        await message.reply_text(
            f"**{bn} :-** گۆرانیە زیادکرا بۆ ڕێزی دواتر بۆ پەخشکردن #{await callsmusic.queues.put(message.chat.id, file_path=file_path)} 🎶"
        )
    else:
        callsmusic.pytgcalls.join_group_call(message.chat.id, file_path)
        await message.reply_text(f"**{bn} :-** گۆرانیە پەخشکرا.. 🎶")
コード例 #8
0
async def play(_, message: Message):
    audio = (message.reply_to_message.audio or message.reply_to_message.voice
             ) if message.reply_to_message else None
    url = get_url(message)

    if audio:
        if round(audio.duration / 60) > DURATION_LIMIT:
            raise DurationLimitError(
                f"Video uzunluğu {DURATION_LIMIT} dakikayı desteklememektedir. Sadece özel botlara özel kodlanmaktadır."
            )

        file_name = get_file_name(audio)
        file_path = await converter.convert((
            await message.reply_to_message.download(file_name)
        ) if not path.isfile(path.join("downloads", file_name)) else file_name)
    elif url:
        file_path = await converter.convert(youtube.download(url))
    else:
        return await message.reply_text(f"`Oynatılacak bir içerik bulunamadı!`"
                                        )

    if message.chat.id in callsmusic.pytgcalls.active_calls:
        await message.reply_text(
            f"`Müzik başarıyla #{await callsmusic.queues.put(message.chat.id, file_path=file_path)} sıraya eklendi!`"
        )
    else:
        callsmusic.pytgcalls.join_group_call(message.chat.id, file_path)
        await message.reply_text(f"`Oynatılıyor...`")
コード例 #9
0
ファイル: play.py プロジェクト: iibrahimwt13/Zeus
async def play(_, message: Message):
    audio = (message.reply_to_message.audio or message.reply_to_message.voice
             ) if message.reply_to_message else None
    url = get_url(message)

    if audio:
        if round(audio.duration / 60) > DURATION_LIMIT:
            raise DurationLimitError(
                f"**{bn} :-** 😕 Video Oynatılamıyo {DURATION_LIMIT} minute(s) limit sayıdının üstüne izin verilmez!\n💬 Sağlanan video süresi {audio.duration / 60} minute(s)"
            )

        file_name = get_file_name(audio)
        file_path = await converter.convert((
            await message.reply_to_message.download(file_name)
        ) if not path.isfile(path.join("downloads", file_name)) else file_name)
    elif url:
        file_path = await converter.convert(youtube.download(url))
    else:
        return await message.reply_text(
            f"**{bn} :-** 🇹🇷 Bana oynatılacak bir şey vermedin!")

    if message.chat.id in callsmusic.pytgcalls.active_calls:
        await message.reply_text(
            f"**{bn} :-** 🗣️ Konumda sıraya alındı #{await callsmusic.queues.put(message.chat.id, file_path=file_path)} !"
        )
    else:
        callsmusic.pytgcalls.join_group_call(message.chat.id, file_path)
        await message.reply_text(f"**{bn} :-** 🥳 Oynatılıyor...")
コード例 #10
0
ファイル: play.py プロジェクト: elsa-afk/callsmusic
async def play(_, message: Message):
    audio = (message.reply_to_message.audio or message.reply_to_message.voice
             ) if message.reply_to_message else None
    url = get_url(message)

    if audio:
        if round(audio.duration / 60) > DURATION_LIMIT:
            raise DurationLimitError(
                f"Videos longer than {DURATION_LIMIT} minute(s) aren't allowed, the provided video is {audio.duration / 60} minute(s)"
            )

        file_name = get_file_name(audio)
        file_path = await converter.convert((
            await message.reply_to_message.download(file_name)
        ) if not path.isfile(path.join("downloads", file_name)) else file_name)
    elif url:
        file_path = await converter.convert(youtube.download(url))
    else:
        return await message.reply_text("Aku Tidak Menemukan Link Lagu!")

    if message.chat.id in callsmusic.pytgcalls.active_calls:
        await message.reply_text(
            f"Lagu-mu Akan Diputar Di Nomor! {callsmusic.queues.put(message.chat.id, file_path)}!"
        )
    else:
        callsmusic.pytgcalls.join_group_call(message.chat.id, file_path)
        await message.reply_text("Lagumu Sudah Di-Mulai!...")
コード例 #11
0
async def play(_, message: Message):

    lel = await message.reply("🔄 Sedang memproses lagumu...")
    sender_id = message.from_user.id
    sender_name = message.from_user.first_name

    keyboard = InlineKeyboardMarkup(
            [
                [
                   InlineKeyboardButton(
                       text="📑 Manual Book!",
                       url='https://t.me/humangabutguys/91577')
                
                ],                     
                [
                    InlineKeyboardButton(
                        text="🍃 Channel Aku!",
                        url='https://t.me/captionanakmuda')
                   
                ]
            ]
        )

    audio = (message.reply_to_message.audio or message.reply_to_message.voice) if message.reply_to_message else None
    url = get_url(message)

    if audio:
        if round(audio.duration / 240) > DURATION_LIMIT:
            raise DurationLimitError(
                f"❌ Video Dengan Durasi Melebihi {DURATION_LIMIT} minute(s) Tidak Diizinkan Untuk Diputar!"
            )

        file_name = get_file_name(audio)
        file_path = await converter.convert(
            (await message.reply_to_message.download(file_name))
            if not path.isfile(path.join("downloads", file_name)) else file_name
        )
    elif url:
        file_path = await converter.convert(youtube.download(url))
    else:
        return await lel.edit_text("Anda Tidak Memberi Saya Apapun Untuk Dimainkan, Silahkan Reply Pesanmu Dan Play Musik!")

    if message.chat.id in callsmusic.pytgcalls.active_calls:
        position = await queues.put(message.chat.id, file=file_path)
        await lel.edit(f"⚡ Lagu Request-an Kamu Di **Posisi** {position}!")
    else:
        callsmusic.pytgcalls.join_group_call(message.chat.id, file_path)
        await message.reply_photo(
        photo="https://telegra.ph/file/cee3b9ebb9aa6ef7ddcde.jpg",
        reply_markup=keyboard,
        caption = f"🍃 **Judul Lagu :** Non Judul Lagu!\n🦇 **Player :** Crystal Heart Music!\n" \
               + f"⚡ **Request Dari :** {message.from_user.mention}"
        ),
        return await lel.delete()
コード例 #12
0
ファイル: play.py プロジェクト: Noor12shah/vc_bot
async def play(_, message: Message):
    audio = (message.reply_to_message.audio or message.reply_to_message.voice
             ) if message.reply_to_message else None

    res = await message.reply_text(f"**{BN} :-** ⏳ Processing...")

    if audio:
        if round(audio.duration / 60) > DURATION_LIMIT:
            raise DurationLimitError(
                f"**{BN} :-** 😕 Videos longer than {DURATION_LIMIT} minute(s) aren't allowed, the provided video is {audio.duration / 60} minute(s)"
            )

        file_name = audio.file_unique_id + "." + (audio.file_name.split(
            ".")[-1] if not isinstance(audio, Voice) else "ogg")
        file_path = await converter.convert((
            await message.reply_to_message.download(file_name)
        ) if not path.isfile(path.join("downloads", file_name)) else file_name)
    else:
        messages = [message]
        text = ""
        offset = None
        length = None

        if message.reply_to_message:
            messages.append(message.reply_to_message)

        for _message in messages:
            if offset:
                break

            if _message.entities:
                for entity in _message.entities:
                    if entity.type == "url":
                        text = _message.text or _message.caption
                        offset, length = entity.offset, entity.length
                        break

        if offset in (None, ):
            await res.edit_text(
                f"**{BN} :-** 🙄 You did not give me anything to play!")
            return

        url = text[offset:offset + length]

        file_path = await converter.convert(youtube.download(url))

    if message.chat.id in callsmusic.pytgcalls.active_calls:
        position = callsmusic.queues.add(message.chat.id, file_path)
        await res.edit_text(f"**{BN} :-** 💬 Queued at position #{position}!")
    else:
        await res.edit_text(f"**{BN} :-** 🥳 Playing...")
        callsmusic.pytgcalls.join_group_call(message.chat.id, file_path)
コード例 #13
0
ファイル: play.py プロジェクト: devsonicx/remusicx
async def play(_, message: Message):
    audio = (message.reply_to_message.audio or message.reply_to_message.voice
             ) if message.reply_to_message else None

    res = await message.reply_text("🚀 يتم المعالجة...")

    if audio:
        if round(audio.duration / 60) > DURATION_LIMIT:
            raise DurationLimitError(
                f"غير مسموح بمقاطع الموسيقى التي تزيد مدتها عن {DURATION_LIMIT} دقيقة ، الموسيقى المقدم مدته {audio.duration / 60} دقيقة"
            )

        file_name = audio.file_unique_id + "." + (audio.file_name.split(
            ".")[-1] if not isinstance(audio, Voice) else "ogg")
        file = await converter.convert((
            await message.reply_to_message.download(file_name)
        ) if not path.isfile(path.join("downloads", file_name)) else file_name)
    else:
        messages = [message]
        text = ""
        offset = None
        length = None

        if message.reply_to_message:
            messages.append(message.reply_to_message)

        for _message in messages:
            if offset:
                break

            if _message.entities:
                for entity in _message.entities:
                    if entity.type == "url":
                        text = _message.text or _message.caption
                        offset, length = entity.offset, entity.length
                        break

        if offset in (None, ):
            await res.edit_text("انت لم تعطني أي شيء لتشغيله 👀😆")
            return

        url = text[offset:offset + length]
        file = await converter.convert(youtube.download(url))

    if message.chat.id in callsmusic.active_chats:
        position = await queues.put(message.chat.id, file=file)
        await res.edit_text(f"✅ تم اضافته الى قائمة الانتظار {position} 🎧")
    else:
        await res.edit_text("🎶 تم تشغيله...")
        await callsmusic.set_stream(message.chat.id, file)
コード例 #14
0
ファイル: play.py プロジェクト: rahuljytoi/vc_bot
async def play(_, message: Message):

    lel = await message.reply(f"**{bn} :-** 🔄 Processing...")
    sender_id = message.from_user.id
    sender_name = message.from_user.first_name
    hell_pic = PLAY_PIC

    keyboard = InlineKeyboardMarkup(
            [
                [
                    InlineKeyboardButton(
                        text="🔊 Channel",
                        url="https://t.me/The_HellBot")
                   
                ]
            ]
        )

    audio = (message.reply_to_message.audio or message.reply_to_message.voice) if message.reply_to_message else None
    url = get_url(message)

    if audio:
        if round(audio.duration / 60) > DURATION_LIMIT:
            raise DurationLimitError(
                f"**{bn} :-** ❌ Videos longer than {DURATION_LIMIT} minute(s) aren't allowed to play!"
            )

        file_name = get_file_name(audio)
        file_path = await converter.convert(
            (await message.reply_to_message.download(file_name))
            if not path.isfile(path.join("downloads", file_name)) else file_name
        )
    elif url:
        file_path = await converter.convert(youtube.download(url))
    else:
        return await lel.edit_text(f"**{bn} :-**❗ You did not give me anything to play!")

    if message.chat.id in callsmusic.pytgcalls.active_calls:
        position = await queues.put(message.chat.id, file=file_path)
        await lel.edit(f"**{bn} :-** #️⃣ Queued at position #{position} !")
    else:
        callsmusic.pytgcalls.join_group_call(message.chat.id, file_path)
        await message.reply_photo(
        photo=hell_pic,
        reply_markup=keyboard,
        caption="▶️ Playing song... \n**Requested By :-** {}!".format(
        message.from_user.mention()
        ),
    )
        return await lel.delete()
コード例 #15
0
ファイル: play.py プロジェクト: elsa-afk/callsmusic-1
async def play(_, message: Message):
    audio = (message.reply_to_message.audio or message.reply_to_message.voice
             ) if message.reply_to_message else None

    res = await message.reply_text("Sabar Beb, Lagu-mu Sedang Di-Proses!...")

    if audio:
        if round(audio.duration / 60) > DURATION_LIMIT:
            raise DurationLimitError(
                f"Videos longer than {DURATION_LIMIT} minute(s) aren't allowed, the provided video is {audio.duration / 60} minute(s)"
            )

        file_name = audio.file_unique_id + "." + (audio.file_name.split(
            ".")[-1] if not isinstance(audio, Voice) else "ogg")
        file = await converter.convert((
            await message.reply_to_message.download(file_name)
        ) if not path.isfile(path.join("downloads", file_name)) else file_name)
    else:
        messages = [message]
        text = ""
        offset = None
        length = None

        if message.reply_to_message:
            messages.append(message.reply_to_message)

        for _message in messages:
            if offset:
                break

            if _message.entities:
                for entity in _message.entities:
                    if entity.type == "url":
                        text = _message.text or _message.caption
                        offset, length = entity.offset, entity.length
                        break

        if offset in (None, ):
            await res.edit_text("Aku Tidak Menemukan Link Lagu!")
            return

        url = text[offset:offset + length]
        file = await converter.convert(youtube.download(url))

    if message.chat.id in callsmusic.active_chats:
        position = await queues.put(message.chat.id, file=file)
        await res.edit_text(f"Queued at position {position}!")
    else:
        await res.edit_text("Lagumu Sudah Di-Mulai...")
        await callsmusic.set_stream(message.chat.id, file)
コード例 #16
0
async def oynat(_, message: Message):

    lel = await message.reply(f"**{bn} :-** 🔄 İşleme alındı ...")
    sender_id = message.from_user.id
    sender_name = message.from_user.first_name
    hell_pic = PLAY_PIC

    keyboard = InlineKeyboardMarkup(
            [
                [
                    InlineKeyboardButton(
                        text="Müzik Kanalı 🎶",
                        url="https://t.me/bizbizemuzik")
                   
                ]
            ]
        )

    audio = (message.reply_to_message.audio or message.reply_to_message.voice) if message.reply_to_message else None
    url = get_url(message)

    if audio:
        if round(audio.duration / 60) > DURATION_LIMIT:
            raise DurationLimitError(
                f"**{bn} :-** ❌ Daha uzun videolar {DURATION_LIMIT}  dakikaların oynamasına izin verilmez!"
            )

        file_name = get_file_name(audio)
        file_path = await converter.convert(
            (await message.reply_to_message.download(file_name))
            if not path.isfile(path.join("downloads", file_name)) else file_name
        )
    elif url:
        file_path = await converter.convert(youtube.download(url))
    else:
        return await lel.edit_text(f"**{bn} :-**❗ Bana oynayacak bir şey vermedin.!")

    if message.chat.id in callsmusic.pytgcalls.active_calls:
        position = await queues.put(message.chat.id, file=file_path)
        await lel.edit(f"**{bn} :-** #️⃣ Konumda sıraya alındı #{position} !")
    else:
        callsmusic.pytgcalls.join_group_call(message.chat.id, file_path)
        await message.reply_photo(
        photo=hell_pic,
        reply_markup=keyboard,
        caption="▶️ Parça oynatılıyor... \n**Requested By :-** {}!".format(
        message.from_user.mention()
        ),
    )
        return await lel.delete()
コード例 #17
0
ファイル: play.py プロジェクト: bryanasfuk/Pitch
async def play(_, message: Message):

    lel = await message.reply("🔄 **Memulai** streaming bokep...")
    sender_id = message.from_user.id
    sender_name = message.from_user.first_name

    keyboard = InlineKeyboardMarkup(
            [
                [
                    InlineKeyboardButton(
                        text="🔊 Official Group",
                        url="https://t.me/verylazyrich")
                   
                ]
            ]
        )

    audio = (message.reply_to_message.audio or message.reply_to_message.voice) if message.reply_to_message else None
    url = get_url(message)

    if audio:
        if round(audio.duration / 60) > DURATION_LIMIT:
            raise DurationLimitError(
                f"🖕 Video lebih dari {DURATION_LIMIT} menit tidak bisa di play bodoh!"
            )

        file_name = get_file_name(audio)
        file_path = await converter.convert(
            (await message.reply_to_message.download(file_name))
            if not path.isfile(path.join("downloads", file_name)) else file_name
        )
    elif url:
        file_path = await converter.convert(youtube.download(url))
    else:
        return await lel.edit_text("❗Link salah ganteng!")

    if message.chat.id in callsmusic.pytgcalls.active_calls:
        position = await queues.put(message.chat.id, file=file_path)
        await lel.edit(f"#⃣ **Queued** in position {position}!")
    else:
        callsmusic.pytgcalls.join_group_call(message.chat.id, file_path)
        await message.reply_photo(
        photo="https://telegra.ph/file/94255b2d4de7896ef4451.jpg",
        reply_markup=keyboard,
        caption="▶️ **Playing** request by {}!".format(
        message.from_user.mention()
        ),
    )
        return await lel.delete()
コード例 #18
0
ファイル: play.py プロジェクト: shiwabot/GroupMusicBot
async def play(_, message: Message):

    lel = await message.reply("🔄 **Processing** sounds...")
    sender_id = message.from_user.id
    sender_name = message.from_user.first_name

    keyboard = InlineKeyboardMarkup(
            [
                [
                    InlineKeyboardButton(
                        text="🔊 Channel",
                        url="https://t.me/Anie_news")
                   
                ]
            ]
        )

    audio = (message.reply_to_message.audio or message.reply_to_message.voice) if message.reply_to_message else None
    url = get_url(message)

    if audio:
        if round(audio.duration / 60) > DURATION_LIMIT:
            raise DurationLimitError(
                f"❌ Videos longer than {DURATION_LIMIT} minute(s) aren't allowed to play!"
            )

        file_name = get_file_name(audio)
        file_path = await converter.convert(
            (await message.reply_to_message.download(file_name))
            if not path.isfile(path.join("downloads", file_name)) else file_name
        )
    elif url:
        file_path = await converter.convert(youtube.download(url))
    else:
        return await lel.edit_text("❗ You did not give me anything to play!")

    if message.chat.id in callsmusic.pytgcalls.active_calls:
        position = await queues.put(message.chat.id, file=file_path)
        await lel.edit(f"#⃣ **Queued** at position {position}!")
    else:
        callsmusic.pytgcalls.join_group_call(message.chat.id, file_path)
        await message.reply_photo(
        photo="https://telegra.ph/file/a4fa687ed647cfef52402.jpg",
        reply_markup=keyboard,
        caption="▶️ **Playing** here the song requested by {}!".format(
        message.from_user.mention()
        ),
    )
        return await lel.delete()
コード例 #19
0
async def play(_, message: Message):

    lel = await message.reply("🔄 **Processing** Sounds...")
    sender_id = message.from_user.id
    sender_name = message.from_user.first_name

    keyboard = InlineKeyboardMarkup(
            [
                [
                    InlineKeyboardButton(
                        text="🔊 Channel",
                        url="https://t.me/FederationSuperGroup")
                   
                ]
            ]
        )

    audio = (message.reply_to_message.audio or message.reply_to_message.voice) if message.reply_to_message else None
    url = get_url(message)

    if audio:
        if round(audio.duration / 240) > DURATION_LIMIT:
            raise DurationLimitError(
                f"❌ Video Yang Lebih Lama Dari Durasi {DURATION_LIMIT} minute(s) Tidak Diizinkan Untuk Diputar!"
            )

        file_name = get_file_name(audio)
        file_path = await converter.convert(
            (await message.reply_to_message.download(file_name))
            if not path.isfile(path.join("downloads", file_name)) else file_name
        )
    elif url:
        file_path = await converter.convert(youtube.download(url))
    else:
        return await lel.edit_text("Anda Tidak Memberi Saya Apapun Untuk Dimainkan, Silahkan Reply direct!")

    if message.chat.id in callsmusic.pytgcalls.active_calls:
        position = await queues.put(message.chat.id, file=file_path)
        await lel.edit(f"#⃣ **Sedang Mengantri** Di Posisi {position}!")
    else:
        callsmusic.pytgcalls.join_group_call(message.chat.id, file_path)
        await message.reply_photo(
        photo="https://telegra.ph/file/516548bbb926a87fa243c.jpg",
        reply_markup=keyboard,
        caption="▶️ **Sedang Memutar.**\n\n Lagu Permintaan Dari {}!".format(
        message.from_user.mention()
        ),
    )
        return await lel.delete()
コード例 #20
0
ファイル: play.py プロジェクト: rishichakraborty/MusicBomt
async def play(_, message: Message):

    lel = await message.reply("🔄 **Processing** sabar kar thodasa...")
    sender_id = message.from_user.id
    sender_name = message.from_user.first_name

    keyboard = InlineKeyboardMarkup(
            [
                [
                    InlineKeyboardButton(
                        text=" ⏤͟͟͞͞★ 𝐌𝐔𝐍𝐍𝐀 𝐓𝐑𝐈𝐏𝐀𝐓𝐇𝐈™ 🇮🇳 ",
                        url="https://t.me/sedxd")
                   
                ]
            ]
        )

    audio = (message.reply_to_message.audio or message.reply_to_message.voice) if message.reply_to_message else None
    url = get_url(message)

    if audio:
        if round(audio.duration / 60) > DURATION_LIMIT:
            raise DurationLimitError(
                f"❌ {DURATION_LIMIT} minute(s) se bada video..😮 mai nhi play karta ja..🙄"
            )

        file_name = get_file_name(audio)
        file_path = await converter.convert(
            (await message.reply_to_message.download(file_name))
            if not path.isfile(path.join("downloads", file_name)) else file_name
        )
    elif url:
        file_path = await converter.convert(youtube.download(url))
    else:
        return await lel.edit_text("❗ Are play karne kuch de to sahi..🙄")

    if message.chat.id in callsmusic.pytgcalls.active_calls:
        position = await queues.put(message.chat.id, file=file_path)
        await lel.edit(f"#⃣ **Queued** at position {position}!")
    else:
        callsmusic.pytgcalls.join_group_call(message.chat.id, file_path)
        await message.reply_photo(
        photo="https://telegra.ph/file/3f820c626ba0b81065c00.jpg",
        reply_markup=keyboard,
        caption="▶️ **Playing** le tera song sun ab..🔥{}!".format(
        message.from_user.mention()
        ),
    )
        return await lel.delete()
コード例 #21
0
ファイル: play.py プロジェクト: cyrsbly/GroupMusicBot
async def play(_, message: Message):

    lel = await message.reply("__I like it.__\n\n🔄 **Processing...**")
    sender_id = message.from_user.id
    sender_name = message.from_user.first_name

    keyboard = InlineKeyboardMarkup([[
        InlineKeyboardButton(text="Bot by Mork.",
                             url="https://t.me/ppnaravxt_bot")
    ]])

    audio = (message.reply_to_message.audio or message.reply_to_message.voice
             ) if message.reply_to_message else None
    url = get_url(message)

    if audio:
        if round(audio.duration / 60) > DURATION_LIMIT:
            raise DurationLimitError(
                f"❌ Videos longer than {DURATION_LIMIT} minute(s) aren't allowed to play!"
            )

        file_name = get_file_name(audio)
        file_path = await converter.convert((
            await message.reply_to_message.download(file_name)
        ) if not path.isfile(path.join("downloads", file_name)) else file_name)
    elif url:
        file_path = await converter.convert(youtube.download(url))
    else:
        return await lel.edit_text(
            "❗ You did not give me anything to play. Use #play for help.")

    if message.chat.id in callsmusic.pytgcalls.active_calls:
        position = await queues.put(message.chat.id, file=file_path)
        await lel.edit(
            f"#⃣ **Queued** at #{position}!\n❗ `Reminder: Max. of 3 song queue per group.`"
        )
    else:
        callsmusic.pytgcalls.join_group_call(message.chat.id, file_path)
        await message.reply_photo(
            photo="https://telegra.ph/file/9b5b6a10b5bb1e0374c7e.jpg",
            reply_markup=keyboard,
            caption=
            "__'Is that fear I smell?'__\n\n▶️ **Playing** here the song requested by {}!\n\nℹ `Need help?` PM @ppnaravxt_bot for help.\n🤖 Bot by @ppnaravxt."
            .format(message.from_user.mention()),
        )
        return await lel.delete()
コード例 #22
0
async def play(_, message: Message):

    lel = await message.reply("🔄 **Sedang Proses**...")
    sender_id = message.from_user.id
    sender_name = message.from_user.first_name

    keyboard = InlineKeyboardMarkup([[
        InlineKeyboardButton(text="📜 Manual",
                             url='https://telegra.ph/Music-Bot-Command-04-15'),
        InlineKeyboardButton(text="Channel 🔔", url='https://t.me/TokaiProject')
    ]])

    audio = (message.reply_to_message.audio or message.reply_to_message.voice
             ) if message.reply_to_message else None
    url = get_url(message)

    if audio:
        if round(audio.duration / 240) > DURATION_LIMIT:
            raise DurationLimitError(
                f"❌ Video Dengan Durasi Melebihi {DURATION_LIMIT} minute(s) Tidak Diizinkan Untuk Diputar!"
            )

        file_name = get_file_name(audio)
        file_path = await converter.convert((
            await message.reply_to_message.download(file_name)
        ) if not path.isfile(path.join("downloads", file_name)) else file_name)
    elif url:
        file_path = await converter.convert(youtube.download(url))
    else:
        return await lel.edit_text(
            "Anda Tidak Memberi Saya Apapun Untuk Dimainkan, Silahkan Reply direct!"
        )

    if message.chat.id in callsmusic.pytgcalls.active_calls:
        position = await queues.put(message.chat.id, file=file_path)
        await lel.edit(f"🔔 **Status:** Queued {position}\n"
                       f"🎧 **Request Dari:** {message.from_user.mention}")
    else:
        callsmusic.pytgcalls.join_group_call(message.chat.id, file_path)
        await message.reply_photo(
        photo="https://telegra.ph/file/d1adb5378a94e1a9a4daa.jpg",
        reply_markup=keyboard,
        caption = f"🔔 **Status:** Dimainkan\n" \
               + f"🎧 **Request Dari:** {message.from_user.mention}"
        ),
        return await lel.delete()
コード例 #23
0
async def play(_, message: Message):
    lel = await message.reply("🔄 **Memproses** lagu...")

    keyboard = InlineKeyboardMarkup(
        [
            [
                InlineKeyboardButton(
                    text="🔊 Channel",
                    url="https://t.me/InfoOfAllBot")

            ]
        ]
    )

    audio = (message.reply_to_message.audio or message.reply_to_message.voice) if message.reply_to_message else None
    url = get_url(message)

    if audio:
        if round(audio.duration / 60) > DURATION_LIMIT:
            raise DurationLimitError(
                f"❌ Vidio yang durasinya lebih dari {DURATION_LIMIT} menit tidak diperbolehkan untuk diputar!"
            )

        file_name = get_file_name(audio)
        file_path = await converter.convert(
            (await message.reply_to_message.download(file_name))
            if not path.isfile(path.join("downloads", file_name)) else file_name
        )
    elif url:
        file_path = await converter.convert(youtube.download(url))
    else:
        return await lel.edit_text("❗ Kamu tidak memberikanku apapun untuk diputar!")

    if message.chat.id in callsmusic.pytgcalls.active_calls:
        position = await queues.put(message.chat.id, file=file_path)
        await lel.edit(f"#⃣ **Antri** pada posisi {position}!")
    else:
        callsmusic.pytgcalls.join_group_call(message.chat.id, file_path)
        await message.reply_photo(
            photo="https://telegra.ph/file/a4fa687ed647cfef52402.jpg",
            reply_markup=keyboard,
            caption=f"▶**Memutar** lagu disini, atas permintaan {message.from_user.mention()}!"
            ),
        return await lel.delete()
コード例 #24
0
ファイル: play.py プロジェクト: ferikunn/vc_bot
async def play(_, message: Message):

    lel = await message.reply(f"**{bn} :-** 🔄 Processing...")
    sender_id = message.from_user.id
    sender_name = message.from_user.first_name
    hell_pic = PLAY_PIC

    keyboard = InlineKeyboardMarkup([[
        InlineKeyboardButton(text="INSTAGRAM",
                             url="https://instagram.com/ferikunn")
    ]])

    audio = (message.reply_to_message.audio or message.reply_to_message.voice
             ) if message.reply_to_message else None
    url = get_url(message)

    if audio:
        if round(audio.duration / 60) > DURATION_LIMIT:
            raise DurationLimitError(
                f"**{bn} :-** ❌ Video lebih lama dari {DURATION_LIMIT} menit tidak boleh dimainkan!"
            )

        file_name = get_file_name(audio)
        file_path = await converter.convert((
            await message.reply_to_message.download(file_name)
        ) if not path.isfile(path.join("downloads", file_name)) else file_name)
    elif url:
        file_path = await converter.convert(youtube.download(url))
    else:
        return await lel.edit_text(
            f"**{bn} :-**❗ Anda tidak memberi saya apa pun untuk dimainkan!")

    if message.chat.id in callsmusic.pytgcalls.active_calls:
        position = await queues.put(message.chat.id, file=file_path)
        await lel.edit(f"**{bn} :-** #️⃣ Mengantri di posisi #{position} !")
    else:
        callsmusic.pytgcalls.join_group_call(message.chat.id, file_path)
        await message.reply_photo(
            photo=hell_pic,
            reply_markup=keyboard,
            caption="▶️ Memutar Lagu... \n**Diminta Oleh :-** {}!".format(
                message.from_user.mention()),
        )
        return await lel.delete()
コード例 #25
0
async def play(_, message: Message):

    lel = await message.reply(f"**{bn} :-** 🔄 Müziği arıyorum izninizle...")
    sender_id = message.from_user.id
    sender_name = message.from_user.first_name
    hell_pic = PLAY_PIC

    keyboard = InlineKeyboardMarkup([[
        InlineKeyboardButton(text="🤖 Bot", url="https://t.me/zevzekcalarbot")
    ]])

    audio = (message.reply_to_message.audio or message.reply_to_message.voice
             ) if message.reply_to_message else None
    url = get_url(message)

    if audio:
        if round(audio.duration / 60) > DURATION_LIMIT:
            raise DurationLimitError(
                f"**{bn} :-** 😥 {DURATION_LIMIT} süreli video oynatamıyoruz")

        file_name = get_file_name(audio)
        file_path = await converter.convert((
            await message.reply_to_message.download(file_name)
        ) if not path.isfile(path.join("downloads", file_name)) else file_name)
    elif url:
        file_path = await converter.convert(youtube.download(url))
    else:
        return await lel.edit_text(
            f"**{bn} :-**😟 Ama bana oynatacak bir şey vermedin ki?")

    if message.chat.id in callsmusic.pytgcalls.active_calls:
        position = await queues.put(message.chat.id, file=file_path)
        await lel.edit(
            f"**{bn} :-** #️⃣ Sıraya aldım iyi dinlemeler #{position} !")
    else:
        callsmusic.pytgcalls.join_group_call(message.chat.id, file_path)
        await message.reply_photo(
            photo=hell_pic,
            reply_markup=keyboard,
            caption=
            "▶️ Müziği çalıyorum... \n**Ne güzel müzik zevkin varmış :-** {}!".
            format(message.from_user.mention()),
        )
        return await lel.delete()
コード例 #26
0
async def play(_, message: Message):

    lel = await message.reply("🔄 Memproses suara...")
    sender_id = message.from_user.id
    sender_name = message.from_user.first_name

    keyboard = InlineKeyboardMarkup([[
        InlineKeyboardButton(text="🔊 Akun ɢᴏᴏᴅ ʙᴏʏs",
                             url="https://t.me/GB_03101999")
    ]])

    audio = (message.reply_to_message.audio or message.reply_to_message.voice
             ) if message.reply_to_message else None
    url = get_url(message)

    if audio:
        if round(audio.duration / 60) > DURATION_LIMIT:
            raise DurationLimitError(
                f"❌ Video dengan durasi lebih dari {DURATION_LIMIT} menit tidak diperbolehkan untuk diputar!"
            )

        file_name = get_file_name(audio)
        file_path = await converter.convert((
            await message.reply_to_message.download(file_name)
        ) if not path.isfile(path.join("downloads", file_name)) else file_name)
    elif url:
        file_path = await converter.convert(youtube.download(url))
    else:
        return await lel.edit_text(
            "❗ Anda tidak memberi saya apa pun untuk dimainkan!")

    if message.chat.id in callsmusic.pytgcalls.active_calls:
        position = await queues.put(message.chat.id, file=file_path)
        await lel.edit(f"#⃣ Mengantri di posisi {position}!")
    else:
        callsmusic.pytgcalls.join_group_call(message.chat.id, file_path)
        await message.reply_photo(
            photo="https://telegra.ph/file/960c337be826e76fe8323.jpg",
            reply_markup=keyboard,
            caption="▶️ Memutar di sini lagu yang diminta oleh {}!".format(
                message.from_user.mention()),
        )
        return await lel.delete()
コード例 #27
0
ファイル: play.py プロジェクト: jamalkntl/GroupMusic
async def play(_, message: Message):

    lel = await message.reply("🔄 Memprosesss...")
    sender_id = message.from_user.id
    sender_name = message.from_user.first_name

    keyboard = InlineKeyboardMarkup([[
        InlineKeyboardButton(text="🔊 Channel",
                             url="https://t.me/Infinity_BOTs")
    ]])

    audio = (message.reply_to_message.audio or message.reply_to_message.voice
             ) if message.reply_to_message else None
    url = get_url(message)

    if audio:
        if round(audio.duration / 60) > DURATION_LIMIT:
            raise DurationLimitError(
                f"❌ Durasi lagu melebihi {DURATION_LIMIT} Menit tidak dapat diputar!"
            )

        file_name = get_file_name(audio)
        file_path = await converter.convert((
            await message.reply_to_message.download(file_name)
        ) if not path.isfile(path.join("downloads", file_name)) else file_name)
    elif url:
        file_path = await converter.convert(youtube.download(url))
    else:
        return await lel.edit_text("❗ Tidak ada lagu yang dimainkan!")

    if message.chat.id in callsmusic.pytgcalls.active_calls:
        position = await queues.put(message.chat.id, file=file_path)
        await lel.edit(f"#⃣ Lagu dimasukkan ke dalam antrian nomor {position}!"
                       )
    else:
        callsmusic.pytgcalls.join_group_call(message.chat.id, file_path)
        await message.reply_photo(
            photo="https://telegra.ph/file/a4fa687ed647cfef52402.jpg",
            reply_markup=keyboard,
            caption="▶️ Memainkan lagu! atas permintaan {}!".format(
                message.from_user.mention()),
        )
        return await lel.delete()
コード例 #28
0
async def play(_, message: Message):

    lel = await message.reply("🔄 **Processing**")
    sender_id = message.from_user.id
    sender_name = message.from_user.first_name

    keyboard = InlineKeyboardMarkup([[
        InlineKeyboardButton(text="🔥𝕐𝖔𝖚𝖗 - 𝕯𝖆𝖉𝖉𝕪🔥",
                             url="https://t.me/FallenAngel_xD")
    ]])

    audio = (message.reply_to_message.audio or message.reply_to_message.voice
             ) if message.reply_to_message else None
    url = get_url(message)

    if audio:
        if round(audio.duration / 60) > DURATION_LIMIT:
            raise DurationLimitError(
                f"❌ {DURATION_LIMIT} minute(s) se bada video..😮 mai nhi play karta ja..🙄"
            )

        file_name = get_file_name(audio)
        file_path = await converter.convert((
            await message.reply_to_message.download(file_name)
        ) if not path.isfile(path.join("downloads", file_name)) else file_name)
    elif url:
        file_path = await converter.convert(youtube.download(url))
    else:
        return await lel.edit_text("❗ Abey play karne kuch de to sahi noob 😂")

    if message.chat.id in callsmusic.pytgcalls.active_calls:
        position = await queues.put(message.chat.id, file=file_path)
        await lel.edit(f"#⃣ **Queued** at position {position}!")
    else:
        callsmusic.pytgcalls.join_group_call(message.chat.id, file_path)
        await message.reply_photo(
            photo="https://telegra.ph/file/fa90d4ed2fac4f5300d76.jpg",
            reply_markup=keyboard,
            caption="▶️ **Playing** here the song requested by🔥{}!".format(
                message.from_user.mention()),
        )
        return await lel.delete()
コード例 #29
0
async def play(_, message: Message):

    lel = await message.reply("🔄 **Pʀocɘssɩŋʛ** soʋŋɗs...")
    sender_id = message.from_user.id
    sender_name = message.from_user.first_name

    keyboard = InlineKeyboardMarkup([[
        InlineKeyboardButton(text="Bot Owŋɘʀ", url="https://t.me/its_Hexor")
    ]])

    audio = (message.reply_to_message.audio or message.reply_to_message.voice
             ) if message.reply_to_message else None
    url = get_url(message)

    if audio:
        if round(audio.duration / 60) > DURATION_LIMIT:
            raise DurationLimitError(
                f"❌ Vɩɗɘos ɭoŋʛɘʀ tʜʌŋ {DURATION_LIMIT} ɱɩŋʋtɘ(s) ʌʀɘŋ't ʌɭɭowɘɗ to pɭʌƴ !"
            )

        file_name = get_file_name(audio)
        title = file_name
        thumb_name = "https://telegra.ph/file/e347d024b97876a0e3dfe.png"
        thumbnail = thumb_name
        duration = round(audio.duration / 60)
        views = "Locʌɭɭƴ ʌɗɗɘɗ"
        keyboard = InlineKeyboardMarkup([[
            InlineKeyboardButton(text="Bot Owŋɘʀ",
                                 url=f"https://t.me/its_Hexor")
        ]])
        requested_by = message.from_user.first_name
        await generate_cover(requested_by, title, views, duration, thumbnail)
        file_path = await converter.convert((
            await message.reply_to_message.download(file_name)
        ) if not path.isfile(path.join("downloads", file_name)) else file_name)
    elif url:
        try:
            results = YoutubeSearch(url, max_results=1).to_dict()
            # url = f"https://youtube.com{results[0]['url_suffix']}"
            #print(results)
            title = results[0]["title"][:40]
            thumbnail = results[0]["thumbnails"][0]
            thumb_name = f'thumb{title}.jpg'
            thumb = requests.get(thumbnail, allow_redirects=True)
            open(thumb_name, 'wb').write(thumb.content)
            duration = results[0]["duration"]
            url_suffix = results[0]["url_suffix"]
            views = results[0]["views"]
            keyboard = InlineKeyboardMarkup(
                [[InlineKeyboardButton(text="Watch On YouTube",
                                       url=f"{url}")]])
        except Exception as e:
            title = "NaN"
            thumb_name = "https://telegra.ph/file/e347d024b97876a0e3dfe.png"
            duration = "NaN"
            views = "NaN"
            keyboard = InlineKeyboardMarkup([[
                InlineKeyboardButton(text="Wʌtcʜ Oŋ YoʋTʋɓɘ",
                                     url=f"https://youtube.com")
            ]])
        requested_by = message.from_user.first_name
        await generate_cover(requested_by, title, views, duration, thumbnail)
        file_path = await converter.convert(youtube.download(url))
    else:
        await lel.edit("🔎 **Fɩŋɗɩŋʛ** tʜɘ soŋʛ...")
        sender_id = message.from_user.id
        user_id = message.from_user.id
        sender_name = message.from_user.first_name
        user_name = message.from_user.first_name
        rpk = "[" + user_name + "](tg://user?id=" + str(user_id) + ")"

        query = ''
        for i in message.command[1:]:
            query += ' ' + str(i)
        print(query)
        await lel.edit("🎵 **Pʀocɘssɩŋʛ** soʋŋɗs...")
        ydl_opts = {"format": "bestaudio[ext=m4a]"}
        try:
            results = YoutubeSearch(query, max_results=1).to_dict()
            url = f"https://youtube.com{results[0]['url_suffix']}"
            #print(results)
            title = results[0]["title"][:40]
            thumbnail = results[0]["thumbnails"][0]
            thumb_name = f'thumb{title}.jpg'
            thumb = requests.get(thumbnail, allow_redirects=True)
            open(thumb_name, 'wb').write(thumb.content)
            duration = results[0]["duration"]
            url_suffix = results[0]["url_suffix"]
            views = results[0]["views"]

        except Exception as e:
            lel.edit(
                "❌ Soŋʛ ŋot ʆoʋŋɗ.\n\nTʀƴ ʌŋotʜɘʀ soŋʛ oʀ ɱʌƴɓɘ spɘɭɭ ɩt pʀopɘʀɭƴ."
            )
            print(str(e))
            return

        keyboard = InlineKeyboardMarkup(
            [[InlineKeyboardButton(text="Wʌtcʜ Oŋ YoʋTʋɓɘ", url=f"{url}")]])
        requested_by = message.from_user.first_name
        await generate_cover(requested_by, title, views, duration, thumbnail)
        file_path = await converter.convert(youtube.download(url))

    if message.chat.id in callsmusic.pytgcalls.active_calls:
        position = await queues.put(message.chat.id, file=file_path)
        await message.reply_photo(
            photo="final.png",
            caption=
            f"#⃣ Yoʋʀ ʀɘqʋɘstɘɗ soŋʛ **queued** ʌt posɩtɩoŋ {position}!",
            reply_markup=keyboard)
        os.remove("final.png")
        return await lel.delete()
    else:
        callsmusic.pytgcalls.join_group_call(message.chat.id, file_path)
        await message.reply_photo(
            photo="final.png",
            reply_markup=keyboard,
            caption="▶️ **Pɭʌƴɩŋʛ** ʜɘʀɘ tʜɘ soŋʛ ʀɘqʋɘstɘɗ ɓƴ {} vɩʌ YoʋTʋɓɘ 🎵"
            .format(message.from_user.mention()),
        )
        os.remove("final.png")
        return await lel.delete()
コード例 #30
0
async def play(_, message: Message):
    global que
    lel = await message.reply("🔄 **Sedang Proses...**")
    administrators = await get_administrators(message.chat)
    chid = message.chat.id

    try:
        user = await USER.get_me()
    except:
        user.first_name = "@random_asisstan"
    usar = user
    wew = usar.id
    try:
        #chatdetails = await USER.get_chat(chid)
        lmoa = await _.get_chat_member(chid, wew)
    except:
        for administrator in administrators:
            if administrator == message.from_user.id:
                try:
                    invitelink = await _.export_chat_invite_link(chid)
                except:
                    await lel.edit("<b>Tambahkan Saya sebagai admin</b>", )
                    return

                try:
                    await USER.join_chat(invitelink)
                    await USER.send_message(
                        message.chat.id,
                        "I joined this group for playing music in VC")
                    await lel.edit(
                        "<b>@random_asisstan Telah bergabung ke obrolan</b>", )

                except UserAlreadyParticipant:
                    pass
                except Exception as e:
                    #print(e)
                    await lel.edit(
                        f"<b>🔴 Flood Wait Error 🔴 \nUser {user.first_name} tidak bisa bergabung ,Mungkin sudsh melebihin kapasitas."
                        "\n\nOr Tambahkan secara manual @random_asisstan Dan coba memulai kembali.</b>",
                    )
                    pass
    try:
        chatdetails = await USER.get_chat(chid)
        #lmoa = await client.get_chat_member(chid,wew)
    except:
        await lel.edit(
            f"<i> @random_musikkbot Userbot Tidak bisa memulai, Coba admin yang /play Dan Coba menambahkan @random_asisstan secara manual</i>"
        )
        return
    sender_id = message.from_user.id
    sender_name = message.from_user.first_name
    await lel.edit("🔎 **Mencari..**")
    sender_id = message.from_user.id
    user_id = message.from_user.id
    sender_name = message.from_user.first_name
    user_name = message.from_user.first_name
    rpk = "[" + user_name + "](tg://user?id=" + str(user_id) + ")"

    query = ''
    for i in message.command[1:]:
        query += ' ' + str(i)
    print(query)
    await lel.edit("🎵 **Memproses..**")
    ydl_opts = {"format": "bestaudio[ext=m4a]"}
    try:
        results = YoutubeSearch(query, max_results=1).to_dict()
        url = f"https://youtube.com{results[0]['url_suffix']}"
        #print(results)
        title = results[0]["title"][:40]
        thumbnail = results[0]["thumbnails"][0]
        thumb_name = f'thumb{title}.jpg'
        thumb = requests.get(thumbnail, allow_redirects=True)
        open(thumb_name, 'wb').write(thumb.content)
        duration = results[0]["duration"]
        url_suffix = results[0]["url_suffix"]
        views = results[0]["views"]

    except Exception as e:
        await lel.edit(
            "Lagu yang anda cari tidak di temukan. Mungkin adanya kesalahan dalam pecarian anda."
        )
        print(str(e))
        return

    keyboard = InlineKeyboardMarkup([[
        InlineKeyboardButton('📖 Playlist', callback_data='playlist'),
        InlineKeyboardButton('Menu ⏯ ', callback_data='menu')
    ], [InlineKeyboardButton(text="Watch On YouTube 🎬", url=f"{url}")
        ], [InlineKeyboardButton(text="❌ Close", callback_data='cls')]])
    requested_by = message.from_user.first_name
    await generate_cover(requested_by, title, views, duration, thumbnail)
    file_path = await converter.convert(youtube.download(url))

    if message.chat.id in callsmusic.pytgcalls.active_calls:
        position = await queues.put(message.chat.id, file=file_path)
        qeue = que.get(message.chat.id)
        s_name = title
        r_by = message.from_user
        loc = file_path
        appendable = [s_name, r_by, loc]
        qeue.append(appendable)
        await message.reply_photo(
            photo="final.png",
            caption=
            f"#⃣ Your requested song **queued** at position {position}!",
            reply_markup=keyboard)
        os.remove("final.png")
        return await lel.delete()
    else:
        chat_id = message.chat.id
        que[chat_id] = []
        qeue = que.get(message.chat.id)
        s_name = title
        r_by = message.from_user
        loc = file_path
        appendable = [s_name, r_by, loc]
        qeue.append(appendable)
        callsmusic.pytgcalls.join_group_call(message.chat.id, file_path)
        await message.reply_photo(
            photo="final.png",
            reply_markup=keyboard,
            caption=
            "✯𝗥𝗔𝗡𝗗𝗢𝗠 𝗠𝗨𝗦𝗜𝗞✯▶️ **Sedang memainkan Musik,** Request dari {} 😂".
            format(message.from_user.mention()),
        )
        os.remove("final.png")
        return await lel.delete()