Actually fix inline message id invalid (for inline message queries) (#683)

* Fix Inline Message ID Invalid

* Update inline_session.py

* Update inline_session.py

Co-authored-by: Dan <14043624+delivrance@users.noreply.github.com>
This commit is contained in:
Ripe 2021-05-15 10:36:37 +05:30 committed by GitHub
parent aef0cce8d9
commit be83f8e25e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -25,7 +25,7 @@ from pyrogram.session import Session
from pyrogram.session.auth import Auth from pyrogram.session.auth import Auth
lock = Lock() lock = Lock()
session = None sessions = {}
async def get_session(client: "pyrogram.Client", dc_id: int): async def get_session(client: "pyrogram.Client", dc_id: int):
@ -33,12 +33,12 @@ async def get_session(client: "pyrogram.Client", dc_id: int):
return client return client
async with lock: async with lock:
global session global sessions
if session is not None: if sessions.get(dc_id):
return session return sessions[dc_id]
session = Session( session = sessions[dc_id] = Session(
client, dc_id, client, dc_id,
await Auth(client, dc_id, False).create(), await Auth(client, dc_id, False).create(),
False, is_media=True False, is_media=True