I have a user bot, that may sometimes encounter pyrogram.errors.UserBannedInChannel. I need to change Client with new api_id and api_hash.
I tried to do something like this:
app: Client = Client(name=SESSION_NAME, api_id=API_ID, api_hash=API_HASH)
try:
...
except pyrogram.errors.UserBannedInChannel:
app.name = 'new_session'
app.api_hash = 'api_hash_2'
app.api_id = 'api_id_2'
app.reload()
But it doesn’t seem to work for me.
compose() is not an option for me.
What can I do?
1