this fixes
This commit is contained in:
parent
bb92e112fe
commit
268efe5aea
@ -1,24 +1,17 @@
|
||||
import os
|
||||
import asyncio
|
||||
|
||||
from driver.queues import QUEUE, clear_queue, get_queue, pop_an_item
|
||||
from driver.veez import bot, call_py
|
||||
from pyrogram.types import InlineKeyboardButton, InlineKeyboardMarkup
|
||||
from pytgcalls.types import Update
|
||||
from pytgcalls.types.input_stream import AudioPiped, AudioVideoPiped
|
||||
from driver.queues import QUEUE, clear_queue, get_queue, pop_an_item
|
||||
from pytgcalls.types.input_stream.quality import (
|
||||
HighQualityAudio,
|
||||
HighQualityVideo,
|
||||
LowQualityVideo,
|
||||
MediumQualityVideo,
|
||||
)
|
||||
from pyrogram.types import (
|
||||
CallbackQuery,
|
||||
InlineKeyboardButton,
|
||||
InlineKeyboardMarkup,
|
||||
Message,
|
||||
)
|
||||
from pyrogram import Client, filters
|
||||
from pytgcalls.types.stream import StreamAudioEnded, StreamVideoEnded
|
||||
|
||||
from pytgcalls.types.stream import StreamAudioEnded
|
||||
|
||||
keyboard = InlineKeyboardMarkup(
|
||||
[
|
||||
@ -27,7 +20,7 @@ keyboard = InlineKeyboardMarkup(
|
||||
InlineKeyboardButton(text="• Cʟᴏsᴇ", callback_data="cls"),
|
||||
]
|
||||
]
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
async def skip_current_song(chat_id):
|
||||
@ -110,12 +103,20 @@ async def stream_end_handler(_, u: Update):
|
||||
chat_id = u.chat_id
|
||||
print(chat_id)
|
||||
op = await skip_current_song(chat_id)
|
||||
if op==1:
|
||||
if op == 1:
|
||||
await bot.send_message(chat_id, "✅ streaming end")
|
||||
elif op==2:
|
||||
await bot.send_message(chat_id, "❌ an error occurred\n\n» **Clearing** __Queues__ and leaving video chat.")
|
||||
elif op == 2:
|
||||
await bot.send_message(
|
||||
chat_id,
|
||||
"❌ an error occurred\n\n» **Clearing** __Queues__ and leaving video chat.",
|
||||
)
|
||||
else:
|
||||
await bot.send_message(chat_id, f"💡 **Streaming next track**\n\n🗂 **Name:** [{op[0]}]({op[1]}) | `{op[2]}`\n💭 **Chat:** `{chat_id}`", disable_web_page_preview=True, reply_markup=keyboard)
|
||||
await bot.send_message(
|
||||
chat_id,
|
||||
f"💡 **Streaming next track**\n\n🗂 **Name:** [{op[0]}]({op[1]}) | `{op[2]}`\n💭 **Chat:** `{chat_id}`",
|
||||
disable_web_page_preview=True,
|
||||
reply_markup=keyboard,
|
||||
)
|
||||
else:
|
||||
pass
|
||||
|
||||
|
@ -2,25 +2,27 @@
|
||||
# Commit Start Date 20/10/2021
|
||||
# Finished On 28/10/2021
|
||||
|
||||
from config import BOT_USERNAME, IMG_1, IMG_2
|
||||
from driver.design.chatname import CHAT_TITLE
|
||||
from driver.design.thumbnail import thumb
|
||||
from driver.filters import command, other_filters
|
||||
from driver.queues import QUEUE, add_to_queue
|
||||
from driver.utils import bash
|
||||
from driver.veez import call_py, user
|
||||
|
||||
# repository stuff
|
||||
from program.utils.inline import stream_markup
|
||||
|
||||
# important things
|
||||
import re
|
||||
import asyncio
|
||||
# pyrogram stuff
|
||||
from pyrogram import Client
|
||||
from pyrogram.errors import UserAlreadyParticipant, UserNotParticipant
|
||||
from pyrogram.types import InlineKeyboardButton, InlineKeyboardMarkup, Message
|
||||
from pyrogram.types import InlineKeyboardMarkup, Message
|
||||
|
||||
# pytgcalls stuff
|
||||
from pytgcalls import StreamType
|
||||
from pytgcalls.types.input_stream import AudioPiped
|
||||
# repository stuff
|
||||
from program.utils.inline import stream_markup
|
||||
from driver.design.thumbnail import thumb
|
||||
from driver.design.chatname import CHAT_TITLE
|
||||
from driver.filters import command, other_filters
|
||||
from driver.queues import QUEUE, add_to_queue
|
||||
from driver.veez import call_py, user
|
||||
from driver.utils import bash
|
||||
from config import ASSISTANT_NAME, BOT_USERNAME, IMG_1, IMG_2
|
||||
|
||||
# youtube-dl stuff
|
||||
from youtubesearchpython import VideosSearch
|
||||
|
||||
@ -39,10 +41,12 @@ def ytsearch(query: str):
|
||||
return 0
|
||||
|
||||
|
||||
async def ytdl(format: str, link: str):
|
||||
stdout, stderr = await bash(f'youtube-dl -g -f "{format}" {link}')
|
||||
async def ytdl(link: str):
|
||||
stdout, stderr = await bash(
|
||||
f'youtube-dl -g -f "best[height<=?720][width<=?1280]" {link}'
|
||||
)
|
||||
if stdout:
|
||||
return 1, stdout.split("\n")[0]
|
||||
return 1, stdout
|
||||
return 0, stderr
|
||||
|
||||
|
||||
@ -53,7 +57,9 @@ async def play(c: Client, m: Message):
|
||||
chat_id = m.chat.id
|
||||
user_id = m.from_user.id
|
||||
if m.sender_chat:
|
||||
return await m.reply_text("you're an __Anonymous__ Admin !\n\n» revert back to user account from admin rights.")
|
||||
return await m.reply_text(
|
||||
"you're an __Anonymous__ Admin !\n\n» revert back to user account from admin rights."
|
||||
)
|
||||
try:
|
||||
aing = await c.get_me()
|
||||
except Exception as e:
|
||||
@ -67,17 +73,20 @@ async def play(c: Client, m: Message):
|
||||
if not a.can_manage_voice_chats:
|
||||
await m.reply_text(
|
||||
"💡 To use me, Give me the following permission below:"
|
||||
+ "\n\n» ❌ __Manage video chat__\n\nOnce done, try again.")
|
||||
+ "\n\n» ❌ __Manage video chat__\n\nOnce done, try again."
|
||||
)
|
||||
return
|
||||
if not a.can_delete_messages:
|
||||
await m.reply_text(
|
||||
"💡 To use me, Give me the following permission below:"
|
||||
+ "\n\n» ❌ __Delete messages__\n\nOnce done, try again.")
|
||||
+ "\n\n» ❌ __Delete messages__\n\nOnce done, try again."
|
||||
)
|
||||
return
|
||||
if not a.can_invite_users:
|
||||
await m.reply_text(
|
||||
"💡 To use me, Give me the following permission below:"
|
||||
+ "\n\n» ❌ __Add users__\n\nOnce done, try again.")
|
||||
+ "\n\n» ❌ __Add users__\n\nOnce done, try again."
|
||||
)
|
||||
return
|
||||
try:
|
||||
ubot = (await user.get_me()).id
|
||||
@ -142,7 +151,9 @@ async def play(c: Client, m: Message):
|
||||
add_to_queue(chat_id, songname, dl, link, "Audio", 0)
|
||||
await suhu.delete()
|
||||
buttons = stream_markup(user_id)
|
||||
requester = f"[{m.from_user.first_name}](tg://user?id={m.from_user.id})"
|
||||
requester = (
|
||||
f"[{m.from_user.first_name}](tg://user?id={m.from_user.id})"
|
||||
)
|
||||
await m.reply_photo(
|
||||
photo=f"{IMG_2}",
|
||||
reply_markup=InlineKeyboardMarkup(buttons),
|
||||
@ -172,8 +183,7 @@ async def play(c: Client, m: Message):
|
||||
gcname = m.chat.title
|
||||
ctitle = await CHAT_TITLE(gcname)
|
||||
image = await thumb(thumbnail, title, userid, ctitle)
|
||||
format = "bestaudio[ext=m4a]"
|
||||
veez, ytlink = await ytdl(format, url)
|
||||
veez, ytlink = await ytdl(url)
|
||||
if veez == 0:
|
||||
await suhu.edit(f"❌ yt-dl issues detected\n\n» `{ytlink}`")
|
||||
else:
|
||||
@ -233,15 +243,16 @@ async def play(c: Client, m: Message):
|
||||
gcname = m.chat.title
|
||||
ctitle = await CHAT_TITLE(gcname)
|
||||
image = await thumb(thumbnail, title, userid, ctitle)
|
||||
format = "bestaudio[ext=m4a]"
|
||||
veez, ytlink = await ytdl(format, url)
|
||||
veez, ytlink = await ytdl(url)
|
||||
if veez == 0:
|
||||
await suhu.edit(f"❌ yt-dl issues detected\n\n» `{ytlink}`")
|
||||
else:
|
||||
if chat_id in QUEUE:
|
||||
pos = add_to_queue(chat_id, songname, ytlink, url, "Audio", 0)
|
||||
await suhu.delete()
|
||||
requester = f"[{m.from_user.first_name}](tg://user?id={m.from_user.id})"
|
||||
requester = (
|
||||
f"[{m.from_user.first_name}](tg://user?id={m.from_user.id})"
|
||||
)
|
||||
buttons = stream_markup(user_id)
|
||||
await m.reply_photo(
|
||||
photo=image,
|
||||
|
@ -2,19 +2,19 @@
|
||||
# Commit Start Date 20/10/2021
|
||||
# Finished On 28/10/2021
|
||||
|
||||
import re
|
||||
import asyncio
|
||||
import re
|
||||
|
||||
from config import ASSISTANT_NAME, BOT_USERNAME, IMG_1, IMG_2
|
||||
from program.utils.inline import stream_markup
|
||||
from driver.design.thumbnail import thumb
|
||||
from config import BOT_USERNAME, IMG_1, IMG_2
|
||||
from driver.design.chatname import CHAT_TITLE
|
||||
from driver.design.thumbnail import thumb
|
||||
from driver.filters import command, other_filters
|
||||
from driver.queues import QUEUE, add_to_queue
|
||||
from driver.veez import call_py, user
|
||||
from program.utils.inline import stream_markup
|
||||
from pyrogram import Client
|
||||
from pyrogram.errors import UserAlreadyParticipant, UserNotParticipant
|
||||
from pyrogram.types import InlineKeyboardButton, InlineKeyboardMarkup, Message
|
||||
from pyrogram.types import InlineKeyboardMarkup, Message
|
||||
from pytgcalls import StreamType
|
||||
from pytgcalls.types.input_stream import AudioVideoPiped
|
||||
from pytgcalls.types.input_stream.quality import (
|
||||
@ -64,7 +64,9 @@ async def vplay(c: Client, m: Message):
|
||||
chat_id = m.chat.id
|
||||
user_id = m.from_user.id
|
||||
if m.sender_chat:
|
||||
return await m.reply_text("you're an __Anonymous__ Admin !\n\n» revert back to user account from admin rights.")
|
||||
return await m.reply_text(
|
||||
"you're an __Anonymous__ Admin !\n\n» revert back to user account from admin rights."
|
||||
)
|
||||
try:
|
||||
aing = await c.get_me()
|
||||
except Exception as e:
|
||||
@ -78,17 +80,20 @@ async def vplay(c: Client, m: Message):
|
||||
if not a.can_manage_voice_chats:
|
||||
await m.reply_text(
|
||||
"💡 To use me, Give me the following permission below:"
|
||||
+ "\n\n» ❌ __Manage video chat__\n\nOnce done, try again.")
|
||||
+ "\n\n» ❌ __Manage video chat__\n\nOnce done, try again."
|
||||
)
|
||||
return
|
||||
if not a.can_delete_messages:
|
||||
await m.reply_text(
|
||||
"💡 To use me, Give me the following permission below:"
|
||||
+ "\n\n» ❌ __Delete messages__\n\nOnce done, try again.")
|
||||
+ "\n\n» ❌ __Delete messages__\n\nOnce done, try again."
|
||||
)
|
||||
return
|
||||
if not a.can_invite_users:
|
||||
await m.reply_text(
|
||||
"💡 To use me, Give me the following permission below:"
|
||||
+ "\n\n» ❌ __Add users__\n\nOnce done, try again.")
|
||||
+ "\n\n» ❌ __Add users__\n\nOnce done, try again."
|
||||
)
|
||||
return
|
||||
try:
|
||||
ubot = (await user.get_me()).id
|
||||
@ -270,7 +275,9 @@ async def vplay(c: Client, m: Message):
|
||||
if chat_id in QUEUE:
|
||||
pos = add_to_queue(chat_id, songname, ytlink, url, "Video", Q)
|
||||
await loser.delete()
|
||||
requester = f"[{m.from_user.first_name}](tg://user?id={m.from_user.id})"
|
||||
requester = (
|
||||
f"[{m.from_user.first_name}](tg://user?id={m.from_user.id})"
|
||||
)
|
||||
buttons = stream_markup(user_id)
|
||||
await m.reply_photo(
|
||||
photo=image,
|
||||
@ -309,7 +316,9 @@ async def vstream(c: Client, m: Message):
|
||||
chat_id = m.chat.id
|
||||
user_id = m.from_user.id
|
||||
if m.sender_chat:
|
||||
return await m.reply_text("you're an __Anonymous__ Admin !\n\n» revert back to user account from admin rights.")
|
||||
return await m.reply_text(
|
||||
"you're an __Anonymous__ Admin !\n\n» revert back to user account from admin rights."
|
||||
)
|
||||
try:
|
||||
aing = await c.get_me()
|
||||
except Exception as e:
|
||||
@ -323,17 +332,20 @@ async def vstream(c: Client, m: Message):
|
||||
if not a.can_manage_voice_chats:
|
||||
await m.reply_text(
|
||||
"💡 To use me, Give me the following permission below:"
|
||||
+ "\n\n» ❌ __Manage video chat__\n\nOnce done, try again.")
|
||||
+ "\n\n» ❌ __Manage video chat__\n\nOnce done, try again."
|
||||
)
|
||||
return
|
||||
if not a.can_delete_messages:
|
||||
await m.reply_text(
|
||||
"💡 To use me, Give me the following permission below:"
|
||||
+ "\n\n» ❌ __Delete messages__\n\nOnce done, try again.")
|
||||
+ "\n\n» ❌ __Delete messages__\n\nOnce done, try again."
|
||||
)
|
||||
return
|
||||
if not a.can_invite_users:
|
||||
await m.reply_text(
|
||||
"💡 To use me, Give me the following permission below:"
|
||||
+ "\n\n» ❌ __Add users__\n\nOnce done, try again.")
|
||||
+ "\n\n» ❌ __Add users__\n\nOnce done, try again."
|
||||
)
|
||||
return
|
||||
try:
|
||||
ubot = (await user.get_me()).id
|
||||
@ -424,7 +436,9 @@ async def vstream(c: Client, m: Message):
|
||||
)
|
||||
add_to_queue(chat_id, "Live Stream", livelink, link, "Video", Q)
|
||||
await loser.delete()
|
||||
requester = f"[{m.from_user.first_name}](tg://user?id={m.from_user.id})"
|
||||
requester = (
|
||||
f"[{m.from_user.first_name}](tg://user?id={m.from_user.id})"
|
||||
)
|
||||
buttons = stream_markup(user_id)
|
||||
await m.reply_photo(
|
||||
photo=f"{IMG_2}",
|
||||
|
Loading…
Reference in New Issue
Block a user