ok
This commit is contained in:
parent
17f40cff37
commit
8e3666eb52
@ -1,7 +1,6 @@
|
||||
from driver.veez import call_py
|
||||
from pytgcalls import PyTgCalls
|
||||
from pytgcalls.types import Update
|
||||
from driver.queues import QUEUE, clear_queue, get_queue, pop_an_item
|
||||
from driver.veez import call_py
|
||||
from pytgcalls.types import Update
|
||||
from pytgcalls.types.input_stream import AudioPiped, AudioVideoPiped
|
||||
from pytgcalls.types.input_stream.quality import (
|
||||
HighQualityAudio,
|
||||
@ -20,35 +19,35 @@ async def skip_current_song(chat_id):
|
||||
clear_queue(chat_id)
|
||||
return 1
|
||||
else:
|
||||
try:
|
||||
songname = chat_queue[1][0]
|
||||
url = chat_queue[1][1]
|
||||
link = chat_queue[1][2]
|
||||
type = chat_queue[1][3]
|
||||
Q = chat_queue[1][4]
|
||||
if type == "Audio":
|
||||
await call_py.change_stream(
|
||||
chat_id,
|
||||
AudioPiped(
|
||||
url,
|
||||
),
|
||||
)
|
||||
elif type == "Video":
|
||||
if Q == 720:
|
||||
hm = HighQualityVideo()
|
||||
elif Q == 480:
|
||||
hm = MediumQualityVideo()
|
||||
elif Q == 360:
|
||||
hm = LowQualityVideo()
|
||||
await call_py.change_stream(
|
||||
chat_id, AudioVideoPiped(url, HighQualityAudio(), hm)
|
||||
)
|
||||
pop_an_item(chat_id)
|
||||
return [songname, link, type]
|
||||
except:
|
||||
await call_py.leave_group_call(chat_id)
|
||||
clear_queue(chat_id)
|
||||
return 2
|
||||
try:
|
||||
songname = chat_queue[1][0]
|
||||
url = chat_queue[1][1]
|
||||
link = chat_queue[1][2]
|
||||
type = chat_queue[1][3]
|
||||
Q = chat_queue[1][4]
|
||||
if type == "Audio":
|
||||
await call_py.change_stream(
|
||||
chat_id,
|
||||
AudioPiped(
|
||||
url,
|
||||
),
|
||||
)
|
||||
elif type == "Video":
|
||||
if Q == 720:
|
||||
hm = HighQualityVideo()
|
||||
elif Q == 480:
|
||||
hm = MediumQualityVideo()
|
||||
elif Q == 360:
|
||||
hm = LowQualityVideo()
|
||||
await call_py.change_stream(
|
||||
chat_id, AudioVideoPiped(url, HighQualityAudio(), hm)
|
||||
)
|
||||
pop_an_item(chat_id)
|
||||
return [songname, link, type]
|
||||
except:
|
||||
await call_py.leave_group_call(chat_id)
|
||||
clear_queue(chat_id)
|
||||
return 2
|
||||
else:
|
||||
return 0
|
||||
|
||||
@ -68,20 +67,27 @@ async def skip_item(chat_id, h):
|
||||
return 0
|
||||
|
||||
|
||||
@call_py.on_kicked()
|
||||
async def kicked_handler(_, chat_id: int):
|
||||
if chat_id in QUEUE:
|
||||
clear_queue(chat_id)
|
||||
|
||||
|
||||
@call_py.on_closed_voice_chat()
|
||||
async def closed_voice_chat_handler(_, chat_id: int):
|
||||
if chat_id in QUEUE:
|
||||
clear_queue(chat_id)
|
||||
|
||||
|
||||
@call_py.on_left()
|
||||
async def left_handler(_, chat_id: int):
|
||||
if chat_id in QUEUE:
|
||||
clear_queue(chat_id)
|
||||
|
||||
|
||||
@call_py.on_stream_end()
|
||||
async def on_end_handler(_, u: Update):
|
||||
async def stream_end_handler(_, u: Update):
|
||||
if isinstance(u, StreamAudioEnded) or isinstance(u, StreamVideoEnded):
|
||||
chat_id = u.chat_id
|
||||
print(chat_id)
|
||||
await skip_current_song(chat_id)
|
||||
|
||||
|
||||
@call_py.on_closed_voice_chat()
|
||||
async def closed_handler(client: PyTgCalls, chat_id: int):
|
||||
if chat_id in QUEUE:
|
||||
clear_queue(chat_id)
|
||||
|
||||
@call_py.on_kicked()
|
||||
async def kicked_handler(client: PyTgCalls, chat_id: int) -> None:
|
||||
if chat_id in QUEUE:
|
||||
clear_queue(chat_id)
|
||||
|
Loading…
Reference in New Issue
Block a user