Skip to content

Commit

Permalink
𝗕π—₯π—”π—‘π——π—˜π—— π—žπ—œπ—‘π—š π—¨π—¦π—˜π—₯𝗕𝗒𝗧
Browse files Browse the repository at this point in the history
  • Loading branch information
WCGKING authored May 8, 2024
1 parent 623347b commit 3877974
Showing 1 changed file with 16 additions and 8 deletions.
24 changes: 16 additions & 8 deletions Branded/modules/utilities/tgcalls.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,27 @@
from pytgcalls.types import Update
from pytgcalls import filters
from pytgcalls.types import ChatUpdate, Update

from . import queues
from ..clients.clients import app, call
from .streams import run_stream, close_stream


async def run_async_calls():
@call.on_left()
@call.on_kicked()
@call.on_closed_voice_chat()
async def stream_services_handler(_, chat_id: int):
return await close_stream(chat_id)
@call.on_update(
filters.chat_update(
ChatUpdate.Status.CLOSED_VOICE_CHAT
)
)
@call.on_update(
filters.chat_update(
ChatUpdate.Status.KICKED | ChatUpdate.Status.LEFT_GROUP,
),
)
async def stream_services_handler(_, update: Update):
return await close_stream(update.chat_id)


@call.on_stream_end()
@call.on_update(filters.stream_end)
async def stream_end_handler(_, update: Update):
chat_id = update.chat_id
queues.task_done(chat_id)
Expand All @@ -23,6 +31,6 @@ async def stream_end_handler(_, update: Update):
file = check["file"]
type = check["type"]
stream = await run_stream(file, type)
return await call.change_stream(chat_id, stream)
return await call.play(chat_id, stream)


0 comments on commit 3877974

Please sign in to comment.