mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2025-06-18 11:06:39 +00:00
Add missing ResolvedPeer, InputNotifyPeer, TopPeer cases
This commit is contained in:
parent
182b6fc1cb
commit
abe26625e6
@ -6,6 +6,7 @@ import math
|
|||||||
import re
|
import re
|
||||||
from mimetypes import add_type, guess_extension
|
from mimetypes import add_type, guess_extension
|
||||||
|
|
||||||
|
from .tl.types.contacts import ResolvedPeer
|
||||||
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, InputPeerEmpty,
|
||||||
@ -20,7 +21,8 @@ from .tl.types import (
|
|||||||
GeoPointEmpty, InputGeoPointEmpty, Photo, InputPhoto, PhotoEmpty,
|
GeoPointEmpty, InputGeoPointEmpty, Photo, InputPhoto, PhotoEmpty,
|
||||||
InputPhotoEmpty, FileLocation, ChatPhotoEmpty, UserProfilePhotoEmpty,
|
InputPhotoEmpty, FileLocation, ChatPhotoEmpty, UserProfilePhotoEmpty,
|
||||||
FileLocationUnavailable, InputMediaUploadedDocument, ChannelFull,
|
FileLocationUnavailable, InputMediaUploadedDocument, ChannelFull,
|
||||||
InputMediaUploadedPhoto, DocumentAttributeFilename, photos
|
InputMediaUploadedPhoto, DocumentAttributeFilename, photos,
|
||||||
|
TopPeer, InputNotifyPeer
|
||||||
)
|
)
|
||||||
|
|
||||||
USERNAME_RE = re.compile(
|
USERNAME_RE = re.compile(
|
||||||
@ -362,6 +364,9 @@ def get_peer_id(peer):
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
if peer.SUBCLASS_OF_ID not in (0x2d45687, 0xc91c90b6):
|
if peer.SUBCLASS_OF_ID not in (0x2d45687, 0xc91c90b6):
|
||||||
|
if isinstance(peer, (ResolvedPeer, InputNotifyPeer, TopPeer)):
|
||||||
|
peer = peer.peer
|
||||||
|
else:
|
||||||
# Not a Peer or an InputPeer, so first get its Input version
|
# Not a Peer or an InputPeer, so first get its Input version
|
||||||
peer = get_input_peer(peer, allow_self=False)
|
peer = get_input_peer(peer, allow_self=False)
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
|
Loading…
Reference in New Issue
Block a user