From 5e2758572c07be18103e0bb95522aed9ddf5ae27 Mon Sep 17 00:00:00 2001 From: levina <82658782+levina-lab@users.noreply.github.com> Date: Tue, 26 Oct 2021 16:08:02 +0700 Subject: [PATCH] prepare --- program/playlist.py | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 program/playlist.py diff --git a/program/playlist.py b/program/playlist.py new file mode 100644 index 0000000..56be837 --- /dev/null +++ b/program/playlist.py @@ -0,0 +1,25 @@ +from config import BOT_USERNAME +from pyrogram.types import Message +from driver.filters import command +from pyrogram import Client, filters +from driver.queues import QUEUE, get_queue + + +@Client.on_message(command(["playlist", f"playlist@{BOT_USERNAME}", "queue", f"queue@{BOT_USERNAME}"]) & other_filters) +async def playlist(client, m: Message): + chat_id = m.chat.id + if chat_id in QUEUE: + chat_queue = get_queue(chat_id) + if len(chat_queue)==1: + await m.reply(f"💡 **now playing:**\n\n[{chat_queue[0][0]}]({chat_queue[0][2]}) | `{chat_queue[0][3]}`", disable_web_page_preview=True) + else: + QUE = f"💡 **now playing:**\n\n[{chat_queue[0][0]}]({chat_queue[0][2]}) | `{chat_queue[0][3]}` \n\n**📖 play-list:**" + l = len(chat_queue) + for x in range (1, l): + han = chat_queue[x][0] + hok = chat_queue[x][2] + hap = chat_queue[x][3] + QUE = QUE + "\n" + f"**#{x}** - [{han}]({hok}) | `{hap}`" + await m.reply(QUE, disable_web_page_preview=True) + else: + await m.reply("❌ **nothing is currently streaming.**")