Answer the question
In order to leave comments, you need to log in
How to organize simultaneous work of several sessions of "userbots" in one pyrogram client?
I use pyrogram.
It is necessary that 2-3 sessions (userbots) work simultaneously in one client.
the view is that it is done through multithreading or asynchrony. But I can't find any example.
I would be grateful for help, and a good example in doubly!
Answer the question
In order to leave comments, you need to log in
from pyrogram import Client, idle
from pyrogram.handlers import MessageHandler
my_apps = [
Client("session1", app, "hash"),
Client("session2", app, "hash"),
Client("session3", app, "hash"),
]
async def test(client, message):
print(message)
for app in my_apps:
app.add_handler(MessageHandler(test))
app.start()
idle()
for app in my_apps:
app.stop()
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question