This commit is contained in:
Tofik Denianto 2021-11-21 12:32:21 +07:00 committed by GitHub
parent 17f40cff37
commit 8e3666eb52
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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.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 import AudioPiped, AudioVideoPiped
from pytgcalls.types.input_stream.quality import ( from pytgcalls.types.input_stream.quality import (
HighQualityAudio, HighQualityAudio,
@ -68,20 +67,27 @@ async def skip_item(chat_id, h):
return 0 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() @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): if isinstance(u, StreamAudioEnded) or isinstance(u, StreamVideoEnded):
chat_id = u.chat_id chat_id = u.chat_id
print(chat_id) print(chat_id)
await skip_current_song(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)