mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2024-11-23 09:53:45 +03:00
Add missing InputPeerSelf case to .get_entity()
This commit is contained in:
parent
17a2946311
commit
1316e07dca
|
@ -84,7 +84,7 @@ from .tl.types import (
|
||||||
InputMessageEntityMentionName, DocumentAttributeVideo,
|
InputMessageEntityMentionName, DocumentAttributeVideo,
|
||||||
UpdateEditMessage, UpdateEditChannelMessage, UpdateShort, Updates,
|
UpdateEditMessage, UpdateEditChannelMessage, UpdateShort, Updates,
|
||||||
MessageMediaWebPage, ChannelParticipantsSearch, PhotoSize, PhotoCachedSize,
|
MessageMediaWebPage, ChannelParticipantsSearch, PhotoSize, PhotoCachedSize,
|
||||||
PhotoSizeEmpty, MessageService, ChatParticipants,
|
PhotoSizeEmpty, MessageService, ChatParticipants, User,
|
||||||
ChannelParticipantsBanned, ChannelParticipantsKicked
|
ChannelParticipantsBanned, ChannelParticipantsKicked
|
||||||
)
|
)
|
||||||
from .tl.types.messages import DialogsSlice
|
from .tl.types.messages import DialogsSlice
|
||||||
|
@ -2358,7 +2358,8 @@ class TelegramClient(TelegramBareClient):
|
||||||
x if isinstance(x, str) else self.get_input_entity(x)
|
x if isinstance(x, str) else self.get_input_entity(x)
|
||||||
for x in entity
|
for x in entity
|
||||||
]
|
]
|
||||||
users = [x for x in inputs if isinstance(x, InputPeerUser)]
|
users = [x for x in inputs
|
||||||
|
if isinstance(x, (InputPeerUser, InputPeerSelf))]
|
||||||
chats = [x.chat_id for x in inputs if isinstance(x, InputPeerChat)]
|
chats = [x.chat_id for x in inputs if isinstance(x, InputPeerChat)]
|
||||||
channels = [x for x in inputs if isinstance(x, InputPeerChannel)]
|
channels = [x for x in inputs if isinstance(x, InputPeerChannel)]
|
||||||
if users:
|
if users:
|
||||||
|
@ -2385,7 +2386,12 @@ class TelegramClient(TelegramBareClient):
|
||||||
# username changes.
|
# username changes.
|
||||||
result = [
|
result = [
|
||||||
self._get_entity_from_string(x) if isinstance(x, str)
|
self._get_entity_from_string(x) if isinstance(x, str)
|
||||||
else id_entity[utils.get_peer_id(x)]
|
else (
|
||||||
|
id_entity[utils.get_peer_id(x)]
|
||||||
|
if not isinstance(x, InputPeerSelf)
|
||||||
|
else next(u for u in id_entity.values()
|
||||||
|
if isinstance(u, User) and u.is_self)
|
||||||
|
)
|
||||||
for x in inputs
|
for x in inputs
|
||||||
]
|
]
|
||||||
return result[0] if single else result
|
return result[0] if single else result
|
||||||
|
|
Loading…
Reference in New Issue
Block a user