[X] I am sure the error is coming from Pyrogram's code and not elsewhere
[X] I have searched in the issue tracker for similar bug reports, including closed ones
[X] I ran pip3 install -U https://github.com/pyrogram/pyrogram/archive/master.zip and reproduced the issue using the latest development version
Description
join_chat is not working as expected in the new type of supergroups.
Steps to reproduce
Create a new supergroup
Enable Join Requests in the group
Try to use client.join_chat method with the t.me/pyrogram (link of the chat) ==> this shows the below logs
Try to use the client.join_chat method with the @pyrogram (username of the chat) ==> workd as expected with the appropriate exception raise getattr( pyrogram.errors.exceptions.bad_request_400.InviteRequestSent: Telegram says: [400 INVITE_REQUEST_SENT] - The request to join this chat or channel has been successfully sent (caused by "channels.JoinChannel")
Traceback (most recent call last):
File "/venv/lib/python3.9/site-packages/pyrogram/methods/advanced/resolve_peer.py", line 62, in resolve_peer
return await self.storage.get_peer_by_id(peer_id)
File "/venv/lib/python3.9/site-packages/pyrogram/storage/sqlite_storage.py", line 142, in get_peer_by_id
raise KeyError(f"ID not found: {peer_id}")
KeyError: 'ID not found: https://t.me/pyrogram'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/venv/lib/python3.9/site-packages/pyrogram/methods/advanced/resolve_peer.py", line 71, in resolve_peer
int(peer_id)
ValueError: invalid literal for int() with base 10: 'https://t.me/pyrogram'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/venv/lib/python3.9/site-packages/pyrogram/methods/advanced/resolve_peer.py", line 74, in resolve_peer
return await self.storage.get_peer_by_username(peer_id)
File "/venv/lib/python3.9/site-packages/pyrogram/storage/sqlite_storage.py", line 154, in get_peer_by_username
raise KeyError(f"Username not found: {username}")
KeyError: 'Username not found: https://t.me/pyrogram'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/bot/bp/eval_exec_ecp.py", line 275, in _run_coro
ret = loop.run_until_complete(task)
File "/usr/local/lib/python3.9/asyncio/base_events.py", line 642, in run_until_complete
return future.result()
File "", line 4, in __aexec
File "/venv/lib/python3.9/site-packages/pyrogram/sync.py", line 74, in coro_wrapper
return await asyncio.wrap_future(asyncio.run_coroutine_threadsafe(coroutine, main_loop))
File "/venv/lib/python3.9/site-packages/pyrogram/methods/chats/join_chat.py", line 70, in join_chat
channel=await self.resolve_peer(chat_id)
File "/venv/lib/python3.9/site-packages/pyrogram/methods/advanced/resolve_peer.py", line 76, in resolve_peer
await self.invoke(
File "/venv/lib/python3.9/site-packages/pyrogram/methods/advanced/invoke.py", line 79, in invoke
r = await self.session.invoke(
File "/venv/lib/python3.9/site-packages/pyrogram/session/session.py", line 389, in invoke
return await self.send(query, timeout=timeout)
File "/venv/lib/python3.9/site-packages/pyrogram/session/session.py", line 357, in send
RPCError.raise_it(result, type(data))
File "/venv/lib/python3.9/site-packages/pyrogram/errors/rpc_error.py", line 91, in raise_it
raise getattr(
pyrogram.errors.exceptions.bad_request_400.UsernameInvalid: Telegram says: [400 USERNAME_INVALID] - The username is invalid (caused by "contacts.ResolveUsername")
Checklist
pip3 install -U https://github.com/pyrogram/pyrogram/archive/master.zip
and reproduced the issue using the latest development versionDescription
join_chat is not working as expected in the new type of supergroups.
Steps to reproduce
Create a new supergroup
Enable Join Requests in the group
Try to use client.join_chat method with the t.me/pyrogram (link of the chat) ==> this shows the below logs
Try to use the client.join_chat method with the @pyrogram (username of the chat) ==> workd as expected with the appropriate exception
raise getattr( pyrogram.errors.exceptions.bad_request_400.InviteRequestSent: Telegram says: [400 INVITE_REQUEST_SENT] - The request to join this chat or channel has been successfully sent (caused by "channels.JoinChannel")
Code example
Logs