A condition should be added that checks so that if InputBotInlineMessageID's dc_id & Client's dc_id are equal, it doesn't create a new session and returns the client itself.
So, we should add this to it:
if dc_id == await client.storage.dc_id():
return client
Steps to reproduce
The get_session won't work if dc_id is the same as bot's dc_id.
And it's used in all edit_inline_message methods.
Code example
# NOTE That's what you have to do
async def get_session(client: "pyrogram.Client", dc_id: int):
if dc_id == await client.storage.dc_id():
return client
async with client.media_sessions_lock:
...
Logs
Traceback (most recent call last):
File "...\handlers\on_chosen_inline.py", line 51, in OnChosenInline
await client.edit_inline_text(
File "...\.venv\Lib\site-packages\pyrogram\methods\messages\edit_inline_text.py", line 78, in edit_inline_text
session = await get_session(self, dc_id)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "...\.venv\Lib\site-packages\pyrogram\methods\messages\inline_session.py", line 40, in get_session
exported_auth = await client.invoke(
^^^^^^^^^^^^^^^^^^^^
File "...\.venv\Lib\site-packages\pyrogram\methods\advanced\invoke.py", line 94, in invoke
r = await session.invoke(
^^^^^^^^^^^^^^^^^^^^^
File "...\.venv\Lib\site-packages\pyrogram\session\session.py", line 401, in invoke
return await self.send(query, timeout=timeout)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "...\.venv\Lib\site-packages\pyrogram\session\session.py", line 369, in send
RPCError.raise_it(result, type(data))
File "...\.venv\Lib\site-packages\pyrogram\errors\rpc_error.py", line 91, in raise_it
raise getattr(
pyrogram.errors.exceptions.bad_request_400.DcIdInvalid: Telegram says: [400 DC_ID_INVALID] - The dc_id parameter is invalid (caused by "auth.ExportAuthorization")
Checklist
pip3 install -U https://github.com/pyrogram/pyrogram/archive/master.zip
and reproduced the issue using the latest development versionDescription
There is a bug in methods.messages.inline_session.
A condition should be added that checks so that if InputBotInlineMessageID's dc_id & Client's dc_id are equal, it doesn't create a new session and returns the client itself.
So, we should add this to it:
Steps to reproduce
The
get_session
won't work ifdc_id
is the same as bot'sdc_id
. And it's used in all edit_inline_message methods.Code example
Logs