client = telethon.TelegramClient(akk,api_id,api_hash)
self.dop_list[akk] = [client]
str(TelegramBaseClient.__init__.<locals>._Loggers)
for i in akks:
loop = asyncio.new_event_loop()
loop.run_until_complete(start(akk,audio,chat))
time.sleep(times+7)
async def start(akk,audio,chat):
async with telethon.TelegramClient(akk,api_id,api_hash) as client:
await client(JoinChannelRequest(chat))
group_call = pytgcalls.GroupCallFactory(client, CLIENT_TYPE).get_file_group_call(audio, "",play_on_repeat=False)
await group_call.start(chat)
await client.run_until_disconnected()
for akk in akks:
proc = Process(target=get_start, args=(akk, audio, chat,))
proc.start()
print("next")
time.sleep(times+7)
def get_start(akk,audio,chat):
loop = asyncio.get_event_loop()
loop.run_until_complete(start(akk,audio,chat))
async def start(akk,audio,chat):
async with telethon.TelegramClient(akk,api_id,api_hash) as client:
await client(JoinChannelRequest(chat))
group_call = pytgcalls.GroupCallFactory(client, CLIENT_TYPE).get_file_group_call(audio, "",play_on_repeat=False)
await group_call.start(chat)
await pyrogram.idle()
loop = asyncio.get_event_loop()
akks = ... #тут твой код
audio = ... #тут твой код
chat = ... #тут твой код
async def start(akk,audio,chat):
pass #тут твой код
async def run_all(akks):
# выполняем все копии start() параллельно в одном потоке и в одном loop
tasks = [start(akk, audio, chat) for akk in akks ]
await asyncio.gather(*tasks)
loop.run_untiL_complete(run_all(akks))
async def main():
with open('seting.json',"r") as f:
contents = json.loads(f.read())
name = contents["content"]
chat = '@testingci'
dop_list = {"e":'e'}
tasks = []
for i in name:
if type(i) == type([]):
akk = "akk/" + i[0]
audio = "media/" + i[1]
tasks.append(start(akk,audio,chat))
await asyncio.gather(*tasks)
async def start(akk,audio,chat):
async with telethon.TelegramClient(akk,api_id,api_hash) as client:
await client(JoinChannelRequest(chat))
group_call = pytgcalls.GroupCallFactory(client, CLIENT_TYPE).get_file_group_call(audio, "",play_on_repeat=False)
await group_call.start(chat)
await pyrogram.idle()
loop = asyncio.get_event_loop()
loop.run_until_complete(main())