video-stream/program/playlist.py

47 lines
1.6 KiB
Python
Raw Normal View History

2022-01-31 12:41:47 +00:00
# Copyright (C) 2021 By Veez Music-Project
# Commit Start Date 20/10/2021
# Finished On 28/10/2021
from config import BOT_USERNAME
from pyrogram.types import (
InlineKeyboardButton,
InlineKeyboardMarkup,
Message,
)
2022-02-16 13:19:44 +00:00
from pyrogram import Client
from driver.decorators import check_blacklist
2022-01-31 12:41:47 +00:00
from driver.queues import QUEUE, get_queue
from driver.filters import command, other_filters
2022-02-20 13:52:47 +00:00
2022-01-31 12:41:47 +00:00
keyboard = InlineKeyboardMarkup(
2022-02-08 00:01:42 +00:00
[[InlineKeyboardButton("🗑 Close", callback_data="set_close")]]
2022-01-31 12:41:47 +00:00
)
@Client.on_message(command(["playlist", f"playlist@{BOT_USERNAME}", "queue", f"queue@{BOT_USERNAME}"]) & other_filters)
@check_blacklist()
2022-01-31 12:41:47 +00:00
async def playlist(client, m: Message):
2022-02-06 04:24:35 +00:00
chat_id = m.chat.id
if chat_id in QUEUE:
chat_queue = get_queue(chat_id)
2022-02-16 13:19:44 +00:00
if len(chat_queue) == 1:
await m.reply(
f"💡 **Currently Streaming**`:`\n\n"
2022-02-20 13:52:47 +00:00
f"➣ [{chat_queue[0][0]}]({chat_queue[0][2]}) | `{chat_queue[0][3]}`",
2022-02-16 13:19:44 +00:00
reply_markup=keyboard, disable_web_page_preview=True)
2022-02-06 04:24:35 +00:00
else:
2022-02-16 13:19:44 +00:00
QUE = f"💡 **Currently Streaming**`:`\n\n" \
2022-02-20 13:52:47 +00:00
f"➣ [{chat_queue[0][0]}]({chat_queue[0][2]}) | `{chat_queue[0][3]}` \n\n" \
2022-02-16 13:19:44 +00:00
f"**📖 Queue song list**`:`\n"
2022-02-06 04:24:35 +00:00
l = len(chat_queue)
2022-02-16 13:19:44 +00:00
for x in range(1, l):
2022-02-06 04:24:35 +00:00
han = chat_queue[x][0]
hok = chat_queue[x][2]
hap = chat_queue[x][3]
2022-02-08 04:42:23 +00:00
QUE = QUE + "\n" + f"`#{x}` - [{han}]({hok}) | `{hap}`"
2022-02-06 04:24:35 +00:00
await m.reply(QUE, reply_markup=keyboard, disable_web_page_preview=True)
else:
await m.reply("❌ **nothing is currently streaming.**")