New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TypeError raised when casting InputPeerSelf to any kind of int in utils.get_peer_id #764
Comments
I think I just need to merge master. |
Thanks a lot, and should the check |
Came here to post exactly this issue! In my case the problem is happening after calling the method
|
@jonbesga You could try this: diff --git a/telethon/telegram_client.py b/telethon/telegram_client.py
index 0592621..06f5180 100644
--- a/telethon/telegram_client.py
+++ b/telethon/telegram_client.py
@@ -2487,8 +2487,8 @@ class TelegramClient(TelegramBareClient):
Returns:
:tl:`InputPeerUser`, :tl:`InputPeerChat` or :tl:`InputPeerChannel`.
"""
- if peer in ('me', 'self'):
- return InputPeerSelf()
+ if peer in ('me', 'self') or isinstance(peer, InputPeerSelf):
+ return self.get_me(input_peer=True)
try:
# First try to get the entity from cache, otherwise figure it out |
Considering this fixed after b7ae612. If it's not please let me know and we can reopen it. |
Ohh. Now I read the original issue more carefully (sorry!). Indeed that documentation line is wrong. |
That sounds reasonable. Thanks, and you have also excluded |
I am using the latest asyncio branch 06af73e :
This line of doc says
get_input_entity
will return InputPeerUser, InputPeerChat, or InputPeerChannel, but the actual code return InputPeerSelf, so this line will raise TypeError when callingutils.get_peer_id
withInputPeerSelf
.Should it be changed to
return await self.get_me(input_peer=True)
?The text was updated successfully, but these errors were encountered: