video-stream/program/playlist.py

40 lines
1.4 KiB
Python
Raw Normal View History

2021-10-28 15:50:04 +00:00
# Copyright (C) 2021 By Veez Music-Project
# Commit Start Date 20/10/2021
# Finished On 28/10/2021
2021-10-26 09:08:02 +00:00
from config import BOT_USERNAME
2021-11-17 04:13:40 +00:00
from pyrogram.types import (
CallbackQuery,
InlineKeyboardButton,
InlineKeyboardMarkup,
Message,
)
2021-10-26 09:08:02 +00:00
from pyrogram import Client, filters
from driver.queues import QUEUE, get_queue
2021-11-10 14:11:28 +00:00
from driver.filters import command, other_filters
2021-10-26 09:08:02 +00:00
2021-11-17 04:13:40 +00:00
keyboard = InlineKeyboardMarkup(
[[InlineKeyboardButton("🗑 Close", callback_data="cls")]]
)
2021-10-26 09:08:02 +00:00
@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:
2021-11-17 04:13:40 +00:00
await m.reply(f"💡 **Currently Streaming:**\n\n• [{chat_queue[0][0]}]({chat_queue[0][2]}) | `{chat_queue[0][3]}`", reply_markup=keyboard)
2021-10-26 09:08:02 +00:00
else:
2021-11-12 00:15:11 +00:00
QUE = f"💡 **Currently Streaming:**\n\n• [{chat_queue[0][0]}]({chat_queue[0][2]}) | `{chat_queue[0][3]}` \n\n**📖 Queue List:**\n"
2021-10-26 09:08:02 +00:00
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}`"
2021-11-17 04:13:40 +00:00
await m.reply(QUE, reply_markup=keyboard)
2021-10-26 09:08:02 +00:00
else:
await m.reply("❌ **nothing is currently streaming.**")