mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2025-01-24 08:14:14 +03:00
Let PeerChat be casted to InputPeerChat automatically
This commit is contained in:
parent
8fd0d7eadd
commit
f88efa7f49
|
@ -6,8 +6,8 @@ from mimetypes import add_type, guess_extension
|
|||
|
||||
from .tl.types import (
|
||||
Channel, ChannelForbidden, Chat, ChatEmpty, ChatForbidden, ChatFull,
|
||||
ChatPhoto, InputPeerChannel, InputPeerChat, InputPeerUser, InputPeerEmpty,
|
||||
InputPeerSelf, MessageMediaDocument, MessageMediaPhoto, PeerChannel,
|
||||
ChatPhoto, InputPeerChannel, InputPeerChat, InputPeerUser,
|
||||
MessageMediaDocument, MessageMediaPhoto, PeerChannel,
|
||||
PeerChat, PeerUser, User, UserFull, UserProfilePhoto)
|
||||
|
||||
|
||||
|
@ -73,6 +73,9 @@ def get_input_peer(entity):
|
|||
if isinstance(entity, ChatFull):
|
||||
return InputPeerChat(entity.id)
|
||||
|
||||
if isinstance(entity, PeerChat):
|
||||
return InputPeerChat(entity.chat_id)
|
||||
|
||||
raise ValueError('Cannot cast {} to any kind of InputPeer.'
|
||||
.format(type(entity).__name__))
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user