2022-02-22 23:33:53 +00:00
|
|
|
"""
|
|
|
|
Video + Music Stream Telegram Bot
|
|
|
|
Copyright (c) 2022-present levina=lab <https://github.com/levina-lab>
|
|
|
|
|
|
|
|
This program is free software: you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but without any warranty; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program. If not, see <https://www.gnu.org/licenses/licenses.html>
|
|
|
|
"""
|
|
|
|
|
2022-01-31 12:41:47 +00:00
|
|
|
|
|
|
|
from config import BOT_USERNAME
|
2022-02-22 23:33:53 +00:00
|
|
|
|
|
|
|
from pyrogram import Client
|
2022-01-31 12:41:47 +00:00
|
|
|
from pyrogram.types import (
|
|
|
|
InlineKeyboardButton,
|
|
|
|
InlineKeyboardMarkup,
|
|
|
|
Message,
|
|
|
|
)
|
2022-02-14 05:38:16 +00:00
|
|
|
|
|
|
|
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)
|
2022-02-14 05:38:16 +00:00
|
|
|
@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.**")
|