コード例 #1
0
ファイル: test.py プロジェクト: trdrive/tgcalls000
async def main(client1, client2, make_out, make_inc):
    # await client1.start()
    await client2.start()

    while not client2.is_connected:
        await asyncio.sleep(1)

    # @client2.on_message(filters.text & filters.outgoing & ~filters.edited & filters.command('test', prefixes='!'))
    # async def test(client, message):
    group_call = GroupCall(client2, '6s.raw', '', False, '')
    await group_call.start('@MarshalCm')

    group_call.add_handler(network_status_changed_handler,
                           GroupCallAction.NETWORK_STATUS_CHANGED)

    @group_call.on_playout_ended
    async def playout_ended_handler(group_call, filename):
        print(f'{filename} is ended')

    group_call.play_on_repeat = False
    await asyncio.sleep(15)
    group_call.restart_playout()
    await asyncio.sleep(15)
    group_call.play_on_repeat = True
    group_call.restart_playout()
    '''
    
    chats = ['@MarshalCm', '@MarshalCh'] * 10
    chats = ['@MarshalCm']
    group_call = pytgcalls.GroupCall(client2, 'input.raw', 'output.raw', False, '')
    for chat in chats:
        await group_call.start(chat, False)
    #
        while not group_call.is_connected:
    #         print('Wait')
            await asyncio.sleep(1)
    #
        print('Connected')

        # print(await group_call.check_group_call())

        # await asyncio.sleep(10)
        # await group_call.reconnect()
        await asyncio.sleep(10000)

        # await group_call.stop()
        # await group_call.start(chat, False)

    '''

    # group_call.native_instance.setAudioInputDevice('VB-Cable')
    # group_call.native_instance.setAudioOutputDevice('default (Built-in Output)')

    # await asyncio.sleep(60)
    # group_call.native_instance.stopGroupCall()

    # await start(client1, client2, make_out, make_inc)

    await pyrogram.idle()
コード例 #2
0
async def restart_playing(client, message: Message):
    input_filename = os.path.join(client.workdir, DEFAULT_DOWNLOAD_DIR,
                                  "input.raw")
    if not VOICE_CHATS or message.chat.id not in VOICE_CHATS:
        group_call = GroupCall(client, input_filename)
        await group_call.start(message.chat.id, False)
        VOICE_CHATS[message.chat.id] = group_call
        await update_userbot_message(
            message, message.text,
            " Joined the Voice Chat and Playing from the Beginning...")
        return
    group_call = VOICE_CHATS[message.chat.id]
    group_call.input_filename = input_filename
    group_call.restart_playout()
    await update_userbot_message(message, message.text,
                                 " Playing from the beginning...")