Add missing ChannelFull case to .get_peer_id()

This commit is contained in:
Lonami Exo 2017-11-12 18:15:32 +01:00
parent 08abef78d6
commit f3e2887452

View File

@ -19,7 +19,7 @@ from .tl.types import (
DocumentEmpty, InputDocumentEmpty, Message, GeoPoint, InputGeoPoint, DocumentEmpty, InputDocumentEmpty, Message, GeoPoint, InputGeoPoint,
GeoPointEmpty, InputGeoPointEmpty, Photo, InputPhoto, PhotoEmpty, GeoPointEmpty, InputGeoPointEmpty, Photo, InputPhoto, PhotoEmpty,
InputPhotoEmpty, FileLocation, ChatPhotoEmpty, UserProfilePhotoEmpty, InputPhotoEmpty, FileLocation, ChatPhotoEmpty, UserProfilePhotoEmpty,
FileLocationUnavailable, InputMediaUploadedDocument, FileLocationUnavailable, InputMediaUploadedDocument, ChannelFull,
InputMediaUploadedPhoto, DocumentAttributeFilename, photos InputMediaUploadedPhoto, DocumentAttributeFilename, photos
) )
@ -325,7 +325,12 @@ def get_peer_id(peer, add_mark=False):
return peer.user_id return peer.user_id
elif isinstance(peer, (PeerChat, InputPeerChat)): elif isinstance(peer, (PeerChat, InputPeerChat)):
return -peer.chat_id if add_mark else peer.chat_id return -peer.chat_id if add_mark else peer.chat_id
elif isinstance(peer, (PeerChannel, InputPeerChannel)): elif isinstance(peer, (PeerChannel, InputPeerChannel, ChannelFull)):
if isinstance(peer, ChannelFull):
# Special case: .get_input_peer can't return InputChannel from
# ChannelFull since it doesn't have an .access_hash attribute.
i = peer.id
else:
i = peer.channel_id i = peer.channel_id
if add_mark: if add_mark:
# Concat -100 through math tricks, .to_supergroup() on Madeline # Concat -100 through math tricks, .to_supergroup() on Madeline