Update to layer 93

This commit is contained in:
Lonami Exo
2019-01-21 20:09:13 +01:00
parent 8f44364c6c
commit bb5c1f24c6
4 changed files with 69 additions and 27 deletions

View File

@@ -65,7 +65,8 @@ class ChatMethods(UserMethods):
if isinstance(filter, type):
if filter in (types.ChannelParticipantsBanned,
types.ChannelParticipantsKicked,
types.ChannelParticipantsSearch):
types.ChannelParticipantsSearch,
types.ChannelParticipantsContacts):
# These require a `q` parameter (support types for convenience)
filter = filter('')
else:

View File

@@ -147,7 +147,8 @@ class DownloadMethods(UserMethods):
media = media.webpage.document or media.webpage.photo
if isinstance(media, (types.MessageMediaPhoto, types.Photo,
types.PhotoSize, types.PhotoCachedSize)):
types.PhotoSize, types.PhotoCachedSize,
types.PhotoStrippedSize)):
return await self._download_photo(
media, file, date, progress_callback
)
@@ -300,11 +301,12 @@ class DownloadMethods(UserMethods):
break
else:
return
if not isinstance(photo, (types.PhotoSize, types.PhotoCachedSize)):
if not isinstance(photo, (types.PhotoSize, types.PhotoCachedSize,
types.PhotoStrippedSize)):
return
file = self._get_proper_filename(file, 'photo', '.jpg', date=date)
if isinstance(photo, types.PhotoCachedSize):
if isinstance(photo, (types.PhotoCachedSize, types.PhotoStrippedSize)):
# No need to download anything, simply write the bytes
if file is bytes:
return photo.bytes

View File

@@ -88,6 +88,8 @@ class AdminLogEvent:
return not ori.new_value
elif isinstance(ori, types.ChannelAdminLogEventActionDeleteMessage):
return ori.message
elif isinstance(ori, types.ChannelAdminLogEventActionDefaultBannedRights):
return ori.prev_banned_rights
@property
def new(self):
@@ -117,6 +119,10 @@ class AdminLogEvent:
return ori.new_participant
elif isinstance(ori, types.ChannelAdminLogEventActionParticipantInvite):
return ori.participant
elif isinstance(ori, types.ChannelAdminLogEventActionDefaultBannedRights):
return ori.new_banned_rights
elif isinstance(ori, types.ChannelAdminLogEventActionStopPoll):
return ori.message
@property
def changed_about(self):
@@ -287,6 +293,28 @@ class AdminLogEvent:
return isinstance(self.original.action,
types.ChannelAdminLogEventActionUpdatePinned)
@property
def changed_default_banned_rights(self):
"""
Whether the default banned rights were changed in this event or not.
If ``True``, `old` and `new` will
be present as :tl:`ChatBannedRights`.
"""
return isinstance(self.original.action,
types.ChannelAdminLogEventActionDefaultBannedRights)
@property
def stopped_poll(self):
"""
Whether a poll was stopped in this event or not.
If ``True``, `new` will be present as
`Message <telethon.tl.custom.message.Message>`.
"""
return isinstance(self.original.action,
types.ChannelAdminLogEventActionStopPoll)
def __str__(self):
return str(self.original)