mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2025-02-09 08:00:53 +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 (
|
from .tl.types import (
|
||||||
Channel, ChannelForbidden, Chat, ChatEmpty, ChatForbidden, ChatFull,
|
Channel, ChannelForbidden, Chat, ChatEmpty, ChatForbidden, ChatFull,
|
||||||
ChatPhoto, InputPeerChannel, InputPeerChat, InputPeerUser, InputPeerEmpty,
|
ChatPhoto, InputPeerChannel, InputPeerChat, InputPeerUser,
|
||||||
InputPeerSelf, MessageMediaDocument, MessageMediaPhoto, PeerChannel,
|
MessageMediaDocument, MessageMediaPhoto, PeerChannel,
|
||||||
PeerChat, PeerUser, User, UserFull, UserProfilePhoto)
|
PeerChat, PeerUser, User, UserFull, UserProfilePhoto)
|
||||||
|
|
||||||
|
|
||||||
|
@ -73,6 +73,9 @@ def get_input_peer(entity):
|
||||||
if isinstance(entity, ChatFull):
|
if isinstance(entity, ChatFull):
|
||||||
return InputPeerChat(entity.id)
|
return InputPeerChat(entity.id)
|
||||||
|
|
||||||
|
if isinstance(entity, PeerChat):
|
||||||
|
return InputPeerChat(entity.chat_id)
|
||||||
|
|
||||||
raise ValueError('Cannot cast {} to any kind of InputPeer.'
|
raise ValueError('Cannot cast {} to any kind of InputPeer.'
|
||||||
.format(type(entity).__name__))
|
.format(type(entity).__name__))
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user