From b985dcd248c781d0b260422de66364e022b71418 Mon Sep 17 00:00:00 2001 From: Lonami Exo Date: Thu, 5 Dec 2019 11:14:02 +0100 Subject: [PATCH] Fix 3.8 syntax warning and erroneous documentation Closes #1340 (syntax warning) Closes #1341 (outdated docs) --- telethon/client/auth.py | 5 ----- telethon/client/messageparse.py | 2 +- telethon/client/messages.py | 2 +- telethon_generator/data/errors.csv | 1 + telethon_generator/data/methods.csv | 2 +- 5 files changed, 4 insertions(+), 8 deletions(-) diff --git a/telethon/client/auth.py b/telethon/client/auth.py index bb0e3a2c..b96ee4dd 100644 --- a/telethon/client/auth.py +++ b/telethon/client/auth.py @@ -464,11 +464,6 @@ class AuthMethods: phone = '+34 123 123 123' sent = await client.send_code_request(phone) print(sent) - - if sent.phone_registered: - print('This phone has an existing account registered') - else: - print('This phone does not have an account registered') """ result = None phone = utils.parse_phone(phone) or self._phone diff --git a/telethon/client/messageparse.py b/telethon/client/messageparse.py index d7e6423e..3a612c68 100644 --- a/telethon/client/messageparse.py +++ b/telethon/client/messageparse.py @@ -75,7 +75,7 @@ class MessageParseMethods: """ Returns a (parsed message, entities) tuple depending on ``parse_mode``. """ - if parse_mode is (): + if parse_mode == (): parse_mode = self._parse_mode else: parse_mode = utils.sanitize_parse_mode(parse_mode) diff --git a/telethon/client/messages.py b/telethon/client/messages.py index b163f7d0..a0939aef 100644 --- a/telethon/client/messages.py +++ b/telethon/client/messages.py @@ -501,7 +501,7 @@ class MessageMethods: photos = await client.get_messages(chat, None, filter=InputMessagesFilterPhotos) # Get messages by ID: - message_1337 = await client.get_messages(chats, ids=1337) + message_1337 = await client.get_messages(chat, ids=1337) """ if len(args) == 1 and 'limit' not in kwargs: if 'min_id' in kwargs and 'max_id' in kwargs: diff --git a/telethon_generator/data/errors.csv b/telethon_generator/data/errors.csv index dbcdac80..b94f9b19 100644 --- a/telethon_generator/data/errors.csv +++ b/telethon_generator/data/errors.csv @@ -218,6 +218,7 @@ RIGHT_FORBIDDEN,403,Either your admin rights do not allow you to do this or you RPC_CALL_FAIL,,"Telegram is having internal issues, please try again later." RPC_MCGET_FAIL,,"Telegram is having internal issues, please try again later." RSA_DECRYPT_FAILED,400,Internal RSA decryption failed +SCHEDULE_BOT_NOT_ALLOWED,400,Bots are not allowed to schedule messages SCHEDULE_DATE_TOO_LATE,400,The date you tried to schedule is too far in the future (last known limit of 1 year and a few hours) SCHEDULE_TOO_MUCH,400,You cannot schedule more messages in this chat (last known limit of 100 per chat) SEARCH_QUERY_EMPTY,400,The search query is empty diff --git a/telethon_generator/data/methods.csv b/telethon_generator/data/methods.csv index b7d7db8c..3ecd2356 100644 --- a/telethon_generator/data/methods.csv +++ b/telethon_generator/data/methods.csv @@ -238,7 +238,7 @@ messages.sendEncryptedFile,user,MSG_WAIT_FAILED messages.sendEncryptedService,user,DATA_INVALID ENCRYPTION_DECLINED MSG_WAIT_FAILED USER_IS_BLOCKED messages.sendInlineBotResult,user,CHAT_SEND_INLINE_FORBIDDEN CHAT_WRITE_FORBIDDEN INLINE_RESULT_EXPIRED PEER_ID_INVALID QUERY_ID_EMPTY SCHEDULE_DATE_TOO_LATE SCHEDULE_TOO_MUCH WEBPAGE_CURL_FAILED WEBPAGE_MEDIA_EMPTY messages.sendMedia,both,BOT_PAYMENTS_DISABLED BOT_POLLS_DISABLED CHANNEL_INVALID CHANNEL_PRIVATE CHAT_ADMIN_REQUIRED CHAT_SEND_MEDIA_FORBIDDEN CHAT_WRITE_FORBIDDEN EXTERNAL_URL_INVALID FILE_PARTS_INVALID FILE_PART_LENGTH_INVALID INPUT_USER_DEACTIVATED MEDIA_CAPTION_TOO_LONG MEDIA_EMPTY PAYMENT_PROVIDER_INVALID PEER_ID_INVALID PHOTO_EXT_INVALID PHOTO_INVALID_DIMENSIONS PHOTO_SAVE_FILE_INVALID POLL_OPTION_DUPLICATE RANDOM_ID_DUPLICATE SCHEDULE_DATE_TOO_LATE SCHEDULE_TOO_MUCH STORAGE_CHECK_FAILED Timeout USER_BANNED_IN_CHANNEL USER_IS_BLOCKED USER_IS_BOT VIDEO_CONTENT_TYPE_INVALID WEBPAGE_CURL_FAILED WEBPAGE_MEDIA_EMPTY -messages.sendMessage,both,AUTH_KEY_DUPLICATED BUTTON_DATA_INVALID BUTTON_TYPE_INVALID BUTTON_URL_INVALID CHANNEL_INVALID CHANNEL_PRIVATE CHAT_ADMIN_REQUIRED CHAT_ID_INVALID CHAT_RESTRICTED CHAT_WRITE_FORBIDDEN ENTITIES_TOO_LONG ENTITY_MENTION_USER_INVALID INPUT_USER_DEACTIVATED MESSAGE_EMPTY MESSAGE_TOO_LONG PEER_ID_INVALID RANDOM_ID_DUPLICATE REPLY_MARKUP_INVALID REPLY_MARKUP_TOO_LONG SCHEDULE_DATE_TOO_LATE SCHEDULE_TOO_MUCH Timeout USER_BANNED_IN_CHANNEL USER_IS_BLOCKED USER_IS_BOT YOU_BLOCKED_USER +messages.sendMessage,both,AUTH_KEY_DUPLICATED BUTTON_DATA_INVALID BUTTON_TYPE_INVALID BUTTON_URL_INVALID CHANNEL_INVALID CHANNEL_PRIVATE CHAT_ADMIN_REQUIRED CHAT_ID_INVALID CHAT_RESTRICTED CHAT_WRITE_FORBIDDEN ENTITIES_TOO_LONG ENTITY_MENTION_USER_INVALID INPUT_USER_DEACTIVATED MESSAGE_EMPTY MESSAGE_TOO_LONG PEER_ID_INVALID RANDOM_ID_DUPLICATE REPLY_MARKUP_INVALID REPLY_MARKUP_TOO_LONG SCHEDULE_BOT_NOT_ALLOWED SCHEDULE_DATE_TOO_LATE SCHEDULE_TOO_MUCH Timeout USER_BANNED_IN_CHANNEL USER_IS_BLOCKED USER_IS_BOT YOU_BLOCKED_USER messages.sendMultiMedia,both,SCHEDULE_DATE_TOO_LATE SCHEDULE_TOO_MUCH messages.sendReaction,User,REACTION_INVALID messages.sendVote,user,