video-stream/program/playlist.py

45 lines
1.7 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 (
CallbackQuery,
InlineKeyboardButton,
InlineKeyboardMarkup,
Message,
)
from pyrogram import Client, filters
from driver.queues import QUEUE, get_queue
from driver.filters import command, other_filters
2022-02-06 04:24:35 +00:00
from driver.database.dbpunish import is_gbanned_user
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)
async def playlist(client, m: Message):
2022-02-06 04:24:35 +00:00
chat_id = m.chat.id
2022-02-07 03:00:09 +00:00
user_id = m.from_user.id
2022-02-06 04:24:35 +00:00
if await is_gbanned_user(user_id):
2022-02-07 03:01:32 +00:00
await m.reply_text("❗️ **You've blocked from using this bot!**")
2022-02-06 04:24:35 +00:00
return
if chat_id in QUEUE:
chat_queue = get_queue(chat_id)
if len(chat_queue)==1:
2022-02-08 04:42:23 +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, disable_web_page_preview=True)
2022-02-06 04:24:35 +00:00
else:
2022-02-08 04:42:23 +00:00
QUE = f"💡 **Currently Streaming**`:`\n\n*️⃣ [{chat_queue[0][0]}]({chat_queue[0][2]}) | `{chat_queue[0][3]}` \n\n**📖 Queue song list**`:`\n"
2022-02-06 04:24:35 +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]
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.**")