Add Dialog to auto cast to peer

This commit is contained in:
Lonami Exo 2019-07-23 12:44:06 +02:00
parent 5498d14e54
commit eb44c6634b

View File

@ -794,12 +794,10 @@ def get_peer(peer):
return peer return peer
elif isinstance(peer, ( elif isinstance(peer, (
types.contacts.ResolvedPeer, types.InputNotifyPeer, types.contacts.ResolvedPeer, types.InputNotifyPeer,
types.TopPeer)): types.TopPeer, types.Dialog, types.DialogPeer)):
return peer.peer return peer.peer
elif isinstance(peer, types.ChannelFull): elif isinstance(peer, types.ChannelFull):
return types.PeerChannel(peer.id) return types.PeerChannel(peer.id)
elif isinstance(peer, types.DialogPeer):
return peer.peer
if peer.SUBCLASS_OF_ID in (0x7d7c6f86, 0xd9c7fc18): if peer.SUBCLASS_OF_ID in (0x7d7c6f86, 0xd9c7fc18):
# ChatParticipant, ChannelParticipant # ChatParticipant, ChannelParticipant