From baedd101104b44c6b11f47d8a1fb48882372e626 Mon Sep 17 00:00:00 2001 From: Lonami Exo Date: Fri, 29 Jun 2018 13:20:45 +0200 Subject: [PATCH 1/7] Update to layer 82 --- telethon/client/dialogs.py | 6 +++-- telethon/utils.py | 3 ++- telethon_generator/data/telegram_api.tl | 29 +++++++++++++++---------- telethon_generator/parsers/tlobject.py | 2 +- 4 files changed, 25 insertions(+), 15 deletions(-) diff --git a/telethon/client/dialogs.py b/telethon/client/dialogs.py index fa388732..1fea2da9 100644 --- a/telethon/client/dialogs.py +++ b/telethon/client/dialogs.py @@ -60,7 +60,8 @@ class DialogMethods(UserMethods): offset_date=offset_date, offset_id=offset_id, offset_peer=offset_peer, - limit=1 + limit=1, + hash=0 )) _total[0] = getattr(dialogs, 'count', len(dialogs.dialogs)) return @@ -70,7 +71,8 @@ class DialogMethods(UserMethods): offset_date=offset_date, offset_id=offset_id, offset_peer=offset_peer, - limit=0 + limit=0, + hash=0 ) while len(seen) < limit: req.limit = min(limit - len(seen), 100) diff --git a/telethon/utils.py b/telethon/utils.py index fb0b9ce5..13dbfb91 100644 --- a/telethon/utils.py +++ b/telethon/utils.py @@ -360,7 +360,8 @@ def get_input_media(media, is_photo=False): return InputMediaContact( phone_number=media.phone_number, first_name=media.first_name, - last_name=media.last_name + last_name=media.last_name, + vcard='' ) if isinstance(media, MessageMediaGeo): diff --git a/telethon_generator/data/telegram_api.tl b/telethon_generator/data/telegram_api.tl index 86b5b751..8652796f 100644 --- a/telethon_generator/data/telegram_api.tl +++ b/telethon_generator/data/telegram_api.tl @@ -41,7 +41,7 @@ inputMediaEmpty#9664f57f = InputMedia; inputMediaUploadedPhoto#1e287d04 flags:# file:InputFile stickers:flags.0?Vector ttl_seconds:flags.1?int = InputMedia; inputMediaPhoto#b3ba0635 flags:# id:InputPhoto ttl_seconds:flags.0?int = InputMedia; inputMediaGeoPoint#f9c44144 geo_point:InputGeoPoint = InputMedia; -inputMediaContact#a6e45987 phone_number:string first_name:string last_name:string = InputMedia; +inputMediaContact#f8ab7dfb phone_number:string first_name:string last_name:string vcard:string = InputMedia; inputMediaUploadedDocument#5b38c6c1 flags:# nosound_video:flags.3?true file:InputFile thumb:flags.2?InputFile mime_type:string attributes:Vector stickers:flags.0?Vector ttl_seconds:flags.1?int = InputMedia; inputMediaDocument#23ab23d2 flags:# id:InputDocument ttl_seconds:flags.0?int = InputMedia; inputMediaVenue#c13d1c11 geo_point:InputGeoPoint title:string address:string provider:string venue_id:string venue_type:string = InputMedia; @@ -127,7 +127,7 @@ messageService#9e19a1f6 flags:# out:flags.1?true mentioned:flags.4?true media_un messageMediaEmpty#3ded6320 = MessageMedia; messageMediaPhoto#695150d7 flags:# photo:flags.0?Photo ttl_seconds:flags.2?int = MessageMedia; messageMediaGeo#56e0d474 geo:GeoPoint = MessageMedia; -messageMediaContact#5e7d2f39 phone_number:string first_name:string last_name:string user_id:int = MessageMedia; +messageMediaContact#cbf24940 phone_number:string first_name:string last_name:string vcard:string user_id:int = MessageMedia; messageMediaUnsupported#9f84f49e = MessageMedia; messageMediaDocument#9cb070d7 flags:# document:flags.0?Document ttl_seconds:flags.2?int = MessageMedia; messageMediaWebPage#a32dd600 webpage:WebPage = MessageMedia; @@ -159,7 +159,7 @@ messageActionBotAllowed#abe9affe domain:string = MessageAction; messageActionSecureValuesSentMe#1b287353 values:Vector credentials:SecureCredentialsEncrypted = MessageAction; messageActionSecureValuesSent#d95c6154 types:Vector = MessageAction; -dialog#e4def5db flags:# pinned:flags.2?true peer:Peer top_message:int read_inbox_max_id:int read_outbox_max_id:int unread_count:int unread_mentions_count:int notify_settings:PeerNotifySettings pts:flags.0?int draft:flags.1?DraftMessage = Dialog; +dialog#e4def5db flags:# pinned:flags.2?true unread_mark:flags.3?true peer:Peer top_message:int read_inbox_max_id:int read_outbox_max_id:int unread_count:int unread_mentions_count:int notify_settings:PeerNotifySettings pts:flags.0?int draft:flags.1?DraftMessage = Dialog; photoEmpty#2331b22d id:long = Photo; photo#9288dd29 flags:# has_stickers:flags.0?true id:long access_hash:long date:int sizes:Vector = Photo; @@ -169,7 +169,7 @@ photoSize#77bfb61b type:string location:FileLocation w:int h:int size:int = Phot photoCachedSize#e9a734fa type:string location:FileLocation w:int h:int bytes:bytes = PhotoSize; geoPointEmpty#1117dd5f = GeoPoint; -geoPoint#2049d70c long:double lat:double = GeoPoint; +geoPoint#296f104 long:double lat:double access_hash:long = GeoPoint; auth.checkedPhone#811ea28e phone_registered:Bool = auth.CheckedPhone; @@ -219,6 +219,7 @@ contacts.blockedSlice#900802a1 count:int blocked:Vector users:Ve messages.dialogs#15ba6c40 dialogs:Vector messages:Vector chats:Vector users:Vector = messages.Dialogs; messages.dialogsSlice#71e094f3 count:int dialogs:Vector messages:Vector chats:Vector users:Vector = messages.Dialogs; +messages.dialogsNotModified#f0e3e596 count:int = messages.Dialogs; messages.messages#8c718e87 messages:Vector chats:Vector users:Vector = messages.Messages; messages.messagesSlice#b446ae3 count:int messages:Vector chats:Vector users:Vector = messages.Messages; @@ -315,6 +316,7 @@ updateFavedStickers#e511996d = Update; updateChannelReadMessagesContents#89893b45 channel_id:int messages:Vector = Update; updateContactsReset#7084a7be = Update; updateChannelAvailableMessages#70db6837 channel_id:int available_min_id:int = Update; +updateDialogUnreadMark#e16459c3 flags:# unread:flags.0?true peer:DialogPeer = Update; updates.state#a56c2a3e pts:int qts:int date:int seq:int unread_count:int = updates.State; @@ -341,7 +343,7 @@ upload.fileCdnRedirect#f18cda44 dc_id:int file_token:bytes encryption_key:bytes dcOption#18b7a10d flags:# ipv6:flags.0?true media_only:flags.1?true tcpo_only:flags.2?true cdn:flags.3?true static:flags.4?true id:int ip_address:string port:int secret:flags.10?bytes = DcOption; -config#eb7bb160 flags:# phonecalls_enabled:flags.1?true default_p2p_contacts:flags.3?true preload_featured_stickers:flags.4?true ignore_phone_entities:flags.5?true revoke_pm_inbox:flags.6?true blocked_mode:flags.8?true date:int expires:int test_mode:Bool this_dc:int dc_options:Vector chat_size_max:int megagroup_size_max:int forwarded_count_max:int online_update_period_ms:int offline_blur_timeout_ms:int offline_idle_timeout_ms:int online_cloud_timeout_ms:int notify_cloud_delay_ms:int notify_default_delay_ms:int push_chat_period_ms:int push_chat_limit:int saved_gifs_limit:int edit_time_limit:int revoke_time_limit:int revoke_pm_time_limit:int rating_e_decay:int stickers_recent_limit:int stickers_faved_limit:int channels_read_media_period:int tmp_sessions:flags.0?int pinned_dialogs_count_max:int call_receive_timeout_ms:int call_ring_timeout_ms:int call_connect_timeout_ms:int call_packet_timeout_ms:int me_url_prefix:string autoupdate_url_prefix:flags.7?string suggested_lang_code:flags.2?string lang_pack_version:flags.2?int = Config; +config#3213dbba flags:# phonecalls_enabled:flags.1?true default_p2p_contacts:flags.3?true preload_featured_stickers:flags.4?true ignore_phone_entities:flags.5?true revoke_pm_inbox:flags.6?true blocked_mode:flags.8?true date:int expires:int test_mode:Bool this_dc:int dc_options:Vector dc_txt_domain_name:string chat_size_max:int megagroup_size_max:int forwarded_count_max:int online_update_period_ms:int offline_blur_timeout_ms:int offline_idle_timeout_ms:int online_cloud_timeout_ms:int notify_cloud_delay_ms:int notify_default_delay_ms:int push_chat_period_ms:int push_chat_limit:int saved_gifs_limit:int edit_time_limit:int revoke_time_limit:int revoke_pm_time_limit:int rating_e_decay:int stickers_recent_limit:int stickers_faved_limit:int channels_read_media_period:int tmp_sessions:flags.0?int pinned_dialogs_count_max:int call_receive_timeout_ms:int call_ring_timeout_ms:int call_connect_timeout_ms:int call_packet_timeout_ms:int me_url_prefix:string autoupdate_url_prefix:flags.7?string gif_search_username:flags.9?string venue_search_username:flags.10?string img_search_username:flags.11?string static_maps_provider:flags.12?string caption_length_max:int message_length_max:int webfile_dc_id:int suggested_lang_code:flags.2?string lang_pack_version:flags.2?int = Config; nearestDc#8e1a1775 country:string this_dc:int nearest_dc:int = NearestDc; @@ -568,7 +570,7 @@ inputBotInlineMessageMediaAuto#3380c786 flags:# message:string entities:flags.1? inputBotInlineMessageText#3dcd7a87 flags:# no_webpage:flags.0?true message:string entities:flags.1?Vector reply_markup:flags.2?ReplyMarkup = InputBotInlineMessage; inputBotInlineMessageMediaGeo#c1b15d65 flags:# geo_point:InputGeoPoint period:int reply_markup:flags.2?ReplyMarkup = InputBotInlineMessage; inputBotInlineMessageMediaVenue#417bbf11 flags:# geo_point:InputGeoPoint title:string address:string provider:string venue_id:string venue_type:string reply_markup:flags.2?ReplyMarkup = InputBotInlineMessage; -inputBotInlineMessageMediaContact#2daf01a7 flags:# phone_number:string first_name:string last_name:string reply_markup:flags.2?ReplyMarkup = InputBotInlineMessage; +inputBotInlineMessageMediaContact#a6edbffd flags:# phone_number:string first_name:string last_name:string vcard:string reply_markup:flags.2?ReplyMarkup = InputBotInlineMessage; inputBotInlineMessageGame#4b425864 flags:# reply_markup:flags.2?ReplyMarkup = InputBotInlineMessage; inputBotInlineResult#88bf9319 flags:# id:string type:string title:flags.1?string description:flags.2?string url:flags.3?string thumb:flags.4?InputWebDocument content:flags.5?InputWebDocument send_message:InputBotInlineMessage = InputBotInlineResult; @@ -580,7 +582,7 @@ botInlineMessageMediaAuto#764cf810 flags:# message:string entities:flags.1?Vecto botInlineMessageText#8c7f65e2 flags:# no_webpage:flags.0?true message:string entities:flags.1?Vector reply_markup:flags.2?ReplyMarkup = BotInlineMessage; botInlineMessageMediaGeo#b722de65 flags:# geo:GeoPoint period:int reply_markup:flags.2?ReplyMarkup = BotInlineMessage; botInlineMessageMediaVenue#8a86659c flags:# geo:GeoPoint title:string address:string provider:string venue_id:string venue_type:string reply_markup:flags.2?ReplyMarkup = BotInlineMessage; -botInlineMessageMediaContact#35edb4d4 flags:# phone_number:string first_name:string last_name:string reply_markup:flags.2?ReplyMarkup = BotInlineMessage; +botInlineMessageMediaContact#18d1cdc2 flags:# phone_number:string first_name:string last_name:string vcard:string reply_markup:flags.2?ReplyMarkup = BotInlineMessage; botInlineResult#11965f3a flags:# id:string type:string title:flags.1?string description:flags.2?string url:flags.3?string thumb:flags.4?WebDocument content:flags.5?WebDocument send_message:BotInlineMessage = BotInlineResult; botInlineMediaResult#17db940b flags:# id:string type:string photo:flags.0?Photo document:flags.1?Document title:flags.2?string description:flags.3?string send_message:BotInlineMessage = BotInlineResult; @@ -623,8 +625,9 @@ topPeerCategoryPeers#fb834291 category:TopPeerCategory count:int peers:Vector chats:Vector users:Vector = contacts.TopPeers; +contacts.topPeersDisabled#b52c939d = contacts.TopPeers; -draftMessageEmpty#ba4baec5 = DraftMessage; +draftMessageEmpty#1b0c841a flags:# date:flags.0?int = DraftMessage; draftMessage#fd8e711f flags:# no_webpage:flags.1?true reply_to_msg_id:flags.0?int message:string entities:flags.3?Vector date:int = DraftMessage; messages.featuredStickersNotModified#4ede3cf = messages.FeaturedStickers; @@ -712,12 +715,13 @@ paymentRequestedInfo#909c3f94 flags:# name:flags.0?string phone:flags.1?string e paymentSavedCredentialsCard#cdc27a1f id:string title:string = PaymentSavedCredentials; -webDocument#c61acbd8 url:string access_hash:long size:int mime_type:string attributes:Vector dc_id:int = WebDocument; +webDocument#1c570ed1 url:string access_hash:long size:int mime_type:string attributes:Vector = WebDocument; webDocumentNoProxy#f9c8bcc6 url:string size:int mime_type:string attributes:Vector = WebDocument; inputWebDocument#9bed434d url:string size:int mime_type:string attributes:Vector = InputWebDocument; inputWebFileLocation#c239d686 url:string access_hash:long = InputWebFileLocation; +inputWebFileGeoPointLocation#9f2221c9 geo_point:InputGeoPoint access_hash:long w:int h:int zoom:int scale:int = InputWebFileLocation; upload.webFile#21e753bc size:int mime_type:string file_type:storage.FileType mtime:int bytes:bytes = upload.WebFile; @@ -980,9 +984,10 @@ contacts.getTopPeers#d4982db5 flags:# correspondents:flags.0?true bots_pm:flags. contacts.resetTopPeerRating#1ae373ac category:TopPeerCategory peer:InputPeer = Bool; contacts.resetSaved#879537f1 = Bool; contacts.getSaved#82f1e39f = Vector; +contacts.toggleTopPeers#8514bdda enabled:Bool = Bool; messages.getMessages#63c66506 id:Vector = messages.Messages; -messages.getDialogs#191ba9c5 flags:# exclude_pinned:flags.0?true offset_date:int offset_id:int offset_peer:InputPeer limit:int = messages.Dialogs; +messages.getDialogs#b098aee6 flags:# exclude_pinned:flags.0?true offset_date:int offset_id:int offset_peer:InputPeer limit:int hash:int = messages.Dialogs; messages.getHistory#dcbb8260 peer:InputPeer offset_id:int offset_date:int add_offset:int limit:int max_id:int min_id:int hash:int = messages.Messages; messages.search#8614ef68 flags:# peer:InputPeer q:string from_id:flags.0?InputUser filter:MessagesFilter min_date:int max_date:int offset_id:int add_offset:int limit:int max_id:int min_id:int hash:int = messages.Messages; messages.readHistory#e306d3a peer:InputPeer max_id:int = messages.AffectedMessages; @@ -1078,6 +1083,8 @@ messages.sendMultiMedia#2095512f flags:# silent:flags.5?true background:flags.6? messages.uploadEncryptedFile#5057c497 peer:InputEncryptedChat file:InputEncryptedFile = EncryptedFile; messages.searchStickerSets#c2b7d08b flags:# exclude_featured:flags.0?true q:string hash:int = messages.FoundStickerSets; messages.getSplitRanges#1cff7e08 = Vector; +messages.markDialogUnread#c286d98f flags:# unread:flags.0?true peer:InputDialogPeer = Bool; +messages.getDialogUnreadMarks#22e24e22 = Vector; updates.getState#edd4882a = updates.State; updates.getDifference#25939651 flags:# pts:int pts_total_limit:flags.0?int date:int qts:int = updates.Difference; @@ -1175,4 +1182,4 @@ langpack.getStrings#2e1ee318 lang_code:string keys:Vector = Vector; -// LAYER 81 +// LAYER 82 diff --git a/telethon_generator/parsers/tlobject.py b/telethon_generator/parsers/tlobject.py index eb8bbdd9..6864b1a3 100644 --- a/telethon_generator/parsers/tlobject.py +++ b/telethon_generator/parsers/tlobject.py @@ -16,7 +16,7 @@ WHITELISTED_MISMATCHING_IDS = { # 0 represents any layer 0: {'ipPortSecret', 'accessPointRule', 'help.configSimple'} } -for i in range(77, 82): +for i in range(77, 83): WHITELISTED_MISMATCHING_IDS[i] = {'channel'} From dfcf414111a5959df0b9438ab284d6087ac6f3f5 Mon Sep 17 00:00:00 2001 From: Harry Date: Fri, 29 Jun 2018 17:45:18 +0300 Subject: [PATCH 2/7] Fix hachoir don't close files by itself (#875) --- telethon/client/uploads.py | 44 ++++++++++++++++++-------------------- 1 file changed, 21 insertions(+), 23 deletions(-) diff --git a/telethon/client/uploads.py b/telethon/client/uploads.py index cd38d024..17b361ef 100644 --- a/telethon/client/uploads.py +++ b/telethon/client/uploads.py @@ -414,32 +414,30 @@ class UploadMethods(MessageParseMethods, UserMethods): os.path.basename(file)) } if utils.is_audio(file) and hachoir: - m = hachoir.metadata.extractMetadata( - hachoir.parser.createParser(file) - ) - attr_dict[types.DocumentAttributeAudio] = \ - types.DocumentAttributeAudio( - voice=voice_note, - title=m.get('title') if m.has( - 'title') else None, - performer=m.get('author') if m.has( - 'author') else None, - duration=int(m.get('duration').seconds - if m.has('duration') else 0) - ) + with hachoir.parser.createParser(file) as parser: + m = hachoir.metadata.extractMetadata(parser) + attr_dict[types.DocumentAttributeAudio] = \ + types.DocumentAttributeAudio( + voice=voice_note, + title=m.get('title') if m.has( + 'title') else None, + performer=m.get('author') if m.has( + 'author') else None, + duration=int(m.get('duration').seconds + if m.has('duration') else 0) + ) if not force_document and utils.is_video(file): if hachoir: - m = hachoir.metadata.extractMetadata( - hachoir.parser.createParser(file) - ) - doc = types.DocumentAttributeVideo( - round_message=video_note, - w=m.get('width') if m.has('width') else 0, - h=m.get('height') if m.has('height') else 0, - duration=int(m.get('duration').seconds - if m.has('duration') else 0) - ) + with hachoir.parser.createParser(file) as parser: + m = hachoir.metadata.extractMetadata(parser) + doc = types.DocumentAttributeVideo( + round_message=video_note, + w=m.get('width') if m.has('width') else 0, + h=m.get('height') if m.has('height') else 0, + duration=int(m.get('duration').seconds + if m.has('duration') else 0) + ) else: doc = types.DocumentAttributeVideo( 0, 1, 1, round_message=video_note) From 53c660d0dca4296141969233f62de9437567ba0e Mon Sep 17 00:00:00 2001 From: Lonami Exo Date: Sat, 30 Jun 2018 13:25:59 +0200 Subject: [PATCH 3/7] Don't remove reader if fd == -1 --- telethon/extensions/tcpclient.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/telethon/extensions/tcpclient.py b/telethon/extensions/tcpclient.py index a3d68ea7..ace0d38c 100644 --- a/telethon/extensions/tcpclient.py +++ b/telethon/extensions/tcpclient.py @@ -119,7 +119,7 @@ class TcpClient: finally: self._socket = None self._closed.set() - if fd: + if fd and fd != -1: self._loop.remove_reader(fd) async def _wait_timeout_or_close(self, coro): From 53fbfb215fc94ca620b42ae684ad9134bfdf1e11 Mon Sep 17 00:00:00 2001 From: Lonami Exo Date: Mon, 2 Jul 2018 18:43:42 +0200 Subject: [PATCH 4/7] Fix Telegram may omit entities' access hash in updates --- telethon/tl/custom/message.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/telethon/tl/custom/message.py b/telethon/tl/custom/message.py index 01397bc1..75a99632 100644 --- a/telethon/tl/custom/message.py +++ b/telethon/tl/custom/message.py @@ -37,6 +37,9 @@ class Message: self._sender = entities.get(self.original_message.from_id) if self._sender: self._input_sender = get_input_peer(self._sender) + if (isinstance(self._input_sender, types.InputPeerUser) + and not self._input_sender.access_hash): + self._input_sender = None else: self._input_sender = None @@ -52,6 +55,9 @@ class Message: self._input_chat = input_chat if not self._input_chat and self._chat: self._input_chat = get_input_peer(self._chat) + if not self._input_chat.access_hash: + # Telegram may omit the hash in updates -> invalid peer + self._input_chat = None if getattr(self.original_message, 'fwd_from', None): self._forward = Forward( From 43afdb9d77de93ccc3417a57eb3ee153e75da149 Mon Sep 17 00:00:00 2001 From: Lonami Exo Date: Tue, 3 Jul 2018 14:05:42 +0200 Subject: [PATCH 5/7] Fix-up 53fbfb2 for InputPeerChat or others --- telethon/tl/custom/message.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/telethon/tl/custom/message.py b/telethon/tl/custom/message.py index 75a99632..e05623f7 100644 --- a/telethon/tl/custom/message.py +++ b/telethon/tl/custom/message.py @@ -37,8 +37,7 @@ class Message: self._sender = entities.get(self.original_message.from_id) if self._sender: self._input_sender = get_input_peer(self._sender) - if (isinstance(self._input_sender, types.InputPeerUser) - and not self._input_sender.access_hash): + if not getattr(self._input_sender, 'access_hash', None): self._input_sender = None else: self._input_sender = None @@ -55,7 +54,7 @@ class Message: self._input_chat = input_chat if not self._input_chat and self._chat: self._input_chat = get_input_peer(self._chat) - if not self._input_chat.access_hash: + if not getattr(self._input_sender, 'access_hash', None): # Telegram may omit the hash in updates -> invalid peer self._input_chat = None From 44630542d00471e1215744bf58c1603b433bed7b Mon Sep 17 00:00:00 2001 From: Lonami Exo Date: Tue, 3 Jul 2018 14:13:44 +0200 Subject: [PATCH 6/7] Fix MessageAction not allowing access to media This caused some issues with events.MessageEdited because some MessageAction can trigger these edit updates such as scoring in a game. --- telethon/tl/custom/message.py | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/telethon/tl/custom/message.py b/telethon/tl/custom/message.py index e05623f7..64c83121 100644 --- a/telethon/tl/custom/message.py +++ b/telethon/tl/custom/message.py @@ -430,16 +430,27 @@ class Message: return self._buttons_count or 0 + @property + def media(self): + """ + Returns the media of the message. + """ + if isinstance(self.original_message, types.Message): + return self.original_message.media + elif isinstance(self.original_message, types.MessageService): + action = self.original_message.action + if isinstance(action, types.MessageActionChatEditPhoto): + return types.MessageMediaPhoto(action.photo) + @property def photo(self): """ If the message media is a photo, this returns the :tl:`Photo` object. """ - if isinstance(self.original_message.media, types.MessageMediaPhoto): - photo = self.original_message.media.photo - if isinstance(photo, types.Photo): - return photo + if isinstance(self.media, types.MessageMediaPhoto): + if isinstance(self.media.photo, types.Photo): + return self.media.photo @property def document(self): @@ -447,10 +458,9 @@ class Message: If the message media is a document, this returns the :tl:`Document` object. """ - if isinstance(self.original_message.media, types.MessageMediaDocument): - doc = self.original_message.media.document - if isinstance(doc, types.Document): - return doc + if isinstance(self.media, types.MessageMediaDocument): + if isinstance(self.media.document, types.Document): + return self.media.document def _document_by_attribute(self, kind, condition=None): """ From b237947af14f0190911e0cfdfe61a9690de34221 Mon Sep 17 00:00:00 2001 From: Lonami Exo Date: Wed, 4 Jul 2018 15:39:26 +0200 Subject: [PATCH 7/7] Update to v1.0.3 --- readthedocs/extra/changelog.rst | 37 +++++++++++++++++++++++++++++++++ telethon/version.py | 2 +- 2 files changed, 38 insertions(+), 1 deletion(-) diff --git a/readthedocs/extra/changelog.rst b/readthedocs/extra/changelog.rst index 1882cf29..e0d01b7d 100644 --- a/readthedocs/extra/changelog.rst +++ b/readthedocs/extra/changelog.rst @@ -14,6 +14,41 @@ it can take advantage of new goodies! .. contents:: List of All Versions +Iterate Messages in Reverse (v1.0.3) +==================================== + +*Published at 2018/07/04* + ++-----------------------+ +| Scheme layer used: 82 | ++-----------------------+ + +Mostly bug fixes, but now there is a new parameter on `client.iter_messages +` to support reversing +the order in which messages are returned. + +Additions +~~~~~~~~~ + +- The mentioned ``reverse`` parameter when iterating over messages. +- A new ``sequential_updates`` parameter when creating the client + for updates to be processed sequentially. This is useful when you + need to make sure that all updates are processed in order, such + as a script that only forwards incoming messages somewhere else. + +Bug fixes +~~~~~~~~~ + +- Count was always ``None`` for `message.button_count + `. +- Some fixes when disconnecting upon dropping the client. +- Support for Python 3.4 in the sync version, and fix media download. +- Some issues with events when accessing the input chat or their media. +- Hachoir wouldn't automatically close the file after reading its metadata. +- Signing in required a named ``code=`` parameter, but usage + without a name was really widespread so it has been reverted. + + Bug Fixes (v1.0.2) ================== @@ -110,6 +145,8 @@ Breaking Changes - ``client.invoke()`` is now ``client(...)``. - ``report_errors`` has been removed since it's currently not used, and ``flood_sleep_threshold`` is now part of the client. +- The ``update_workers`` and ``spawn_read_thread`` arguments are gone. + Simply remove them from your code when you create the client. - Methods with a lot of arguments can no longer be used without specifying their argument. Instead you need to use named arguments. This improves readability and not needing to learn the order of the arguments, which diff --git a/telethon/version.py b/telethon/version.py index 158d2dce..eb620e48 100644 --- a/telethon/version.py +++ b/telethon/version.py @@ -1,3 +1,3 @@ # Versions should comply with PEP440. # This line is parsed in setup.py: -__version__ = '1.0.2' +__version__ = '1.0.3'