コード例 #1
0
from pyrogram import Client as TelegramClient
from pytgcalls import PyTgCalls

from config import SESSION_NAME, API_ID, API_HASH

telegram_client = TelegramClient(SESSION_NAME, API_ID, API_HASH)
pytgcalls = PyTgCalls()
open("server.env", "w+").write("\n".join(
    f"{k}={v!r}" for k, v in {
        "HOST": pytgcalls._host,
        "PORT": pytgcalls._port,
        "SESSION_ID": pytgcalls._session_id
    }.items()))
pytgcalls.run(telegram_client)
コード例 #2
0
ファイル: __main__.py プロジェクト: Ryomen-Sukuna/pytgcalls
        call_py.pause_stream(message.chat.id, )

    @app.on_message(filters.regex('!resume'))
    async def resume_handler(_: Client, message: Message):
        call_py.resume_stream(message.chat.id, )

    @app.on_message(filters.regex('!stop'))
    async def stop_handler(client: Client, message: Message):
        call_py.leave_group_call(message.chat.id, )

    @app.on_message(filters.regex('!change_volume'))
    async def change_volume_handler(client: Client, message: Message):
        call_py.change_volume_call(
            message.chat.id,
            50,
        )

    @call_py.on_kicked()
    async def kicked_handler(chat_id: int):
        print(f'Kicked from {chat_id}')

    @call_py.on_raw_update()
    async def raw_handler(json):
        print(json)

    @call_py.on_stream_end()
    async def stream_end_handler(chat_id: int):
        print(f'Stream endend in {chat_id}')

    call_py.run()