2
0
mirror of https://github.com/pyrogram/pyrogram synced 2025-08-28 04:48:06 +00:00

Fix DC sessions for inline message edits (#585)

This commit is contained in:
Ripe 2021-01-10 14:59:27 +00:00 committed by GitHub
parent 99829eff9c
commit 38d60f5e10
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -26,13 +26,9 @@ from pyrogram.session.auth import Auth
lock = Lock()
session = None
dest_dc_id = 4
async def get_session(client: "pyrogram.Client", dc_id: int):
if dc_id != dest_dc_id:
return client
if dc_id == await client.storage.dc_id():
return client
@ -43,8 +39,8 @@ async def get_session(client: "pyrogram.Client", dc_id: int):
return session
session = Session(
client, dest_dc_id,
await Auth(client, dest_dc_id, False).create(),
client, dc_id,
await Auth(client, dc_id, False).create(),
False, is_media=True
)
@ -53,7 +49,7 @@ async def get_session(client: "pyrogram.Client", dc_id: int):
for _ in range(3):
exported_auth = await client.send(
raw.functions.auth.ExportAuthorization(
dc_id=dest_dc_id
dc_id=dc_id
)
)