From 61f2d7c968a089caf714ed943cab0c8eae86b268 Mon Sep 17 00:00:00 2001 From: zeroone2numeral2 Date: Sun, 25 Nov 2018 16:56:39 +0000 Subject: [PATCH 01/15] Added web_page attribute to Message object --- pyrogram/client/ext/utils.py | 4 ++++ pyrogram/client/types/messages_and_media/message.py | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/pyrogram/client/ext/utils.py b/pyrogram/client/ext/utils.py index a543e6b5..9cce212d 100644 --- a/pyrogram/client/ext/utils.py +++ b/pyrogram/client/ext/utils.py @@ -327,6 +327,7 @@ def parse_messages( video_note = None sticker = None document = None + web_page = None media = message.media @@ -574,6 +575,8 @@ def parse_messages( file_size=doc.size, date=doc.date ) + elif isinstance(media, types.MessageMediaWebPage): + web_page = True else: media = None @@ -621,6 +624,7 @@ def parse_messages( video_note=video_note, sticker=sticker, document=document, + web_page=web_page, views=message.views, via_bot=parse_user(users.get(message.via_bot_id, None)), outgoing=message.out, diff --git a/pyrogram/client/types/messages_and_media/message.py b/pyrogram/client/types/messages_and_media/message.py index 404ad39d..19bdd067 100644 --- a/pyrogram/client/types/messages_and_media/message.py +++ b/pyrogram/client/types/messages_and_media/message.py @@ -134,6 +134,9 @@ class Message(Object): venue (:obj:`Venue `, *optional*): Message is a venue, information about the venue. + web_page (``bool``, *optional*): + Message was sent with a webpage preview. + new_chat_members (List of :obj:`User `, *optional*): New members that were added to the group or supergroup and information about them (the bot itself may be one of these members). @@ -246,6 +249,7 @@ class Message(Object): contact=None, location=None, venue=None, + web_page=None, new_chat_members: list = None, left_chat_member=None, new_chat_title: str = None, @@ -297,6 +301,7 @@ class Message(Object): self.contact = contact # flags.22?Contact self.location = location # flags.23?Location self.venue = venue # flags.24?Venue + self.web_page = web_page self.new_chat_members = new_chat_members # flags.25?Vector self.left_chat_member = left_chat_member # flags.26?User self.new_chat_title = new_chat_title # flags.27?string From 2d1a7871ea068165093b3d047be05a1dad2268c5 Mon Sep 17 00:00:00 2001 From: zeroone2numeral2 Date: Sun, 25 Nov 2018 17:05:59 +0000 Subject: [PATCH 02/15] Added Filters.web_page --- pyrogram/client/filters/filters.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pyrogram/client/filters/filters.py b/pyrogram/client/filters/filters.py index 6042173f..9ae15239 100644 --- a/pyrogram/client/filters/filters.py +++ b/pyrogram/client/filters/filters.py @@ -118,6 +118,9 @@ class Filters: venue = create("Venue", lambda _, m: bool(m.venue)) """Filter messages that contain :obj:`Venue ` objects.""" + web_page = create("WebPage", lambda _, m: m.web_page) + """Filter messages sent with a webpage preview.""" + private = create("Private", lambda _, m: bool(m.chat and m.chat.type == "private")) """Filter messages sent in private chats.""" From ac8fc58a06f80eb75c30a3d8db2a061f5eb34929 Mon Sep 17 00:00:00 2001 From: Dan <14043624+delivrance@users.noreply.github.com> Date: Sat, 8 Dec 2018 16:41:30 +0100 Subject: [PATCH 03/15] Add a note hinting about basic support for web pages --- pyrogram/client/types/messages_and_media/message.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pyrogram/client/types/messages_and_media/message.py b/pyrogram/client/types/messages_and_media/message.py index 19bdd067..2c7a97ff 100644 --- a/pyrogram/client/types/messages_and_media/message.py +++ b/pyrogram/client/types/messages_and_media/message.py @@ -136,6 +136,9 @@ class Message(Object): web_page (``bool``, *optional*): Message was sent with a webpage preview. + **Note:** Support for web pages is still basic; a simple boolean is set in case the message contains a + web page preview. In future versions this property could turn into a full web page object that contains + more details. new_chat_members (List of :obj:`User `, *optional*): New members that were added to the group or supergroup and information about them From 19ad70455fef1bc4328b23dbe905d604aa0671c1 Mon Sep 17 00:00:00 2001 From: Dan <14043624+delivrance@users.noreply.github.com> Date: Mon, 10 Dec 2018 15:15:21 +0100 Subject: [PATCH 04/15] Update welcome_bot.py example Delete the previous message in case of consecutive member joins and send a new one containing the names of all the previous new members --- examples/welcome_bot.py | 38 ++++++++++++++++++++++++++++---------- 1 file changed, 28 insertions(+), 10 deletions(-) diff --git a/examples/welcome_bot.py b/examples/welcome_bot.py index 5dbb44fb..2598a802 100644 --- a/examples/welcome_bot.py +++ b/examples/welcome_bot.py @@ -6,22 +6,40 @@ to make it only work for specific messages in a specific chat. from pyrogram import Client, Emoji, Filters -MENTION = "[{}](tg://user?id={})" -MESSAGE = "{} Welcome to [Pyrogram](https://docs.pyrogram.ml/)'s group chat {}!" +USER = "**{}**" +MESSAGE = "{} Welcome to [Pyrogram](https://docs.pyrogram.ml/)'s group chat {{}}!".format(Emoji.SPARKLES) -app = Client("my_account") +app = Client("dan_prod") + +enabled_groups = Filters.chat("PyrogramLounge") +last_welcomes = {} -@app.on_message(Filters.chat("PyrogramChat") & Filters.new_chat_members) +@app.on_message(enabled_groups & Filters.new_chat_members) def welcome(client, message): - # Build the new members list (with mentions) by using their first_name - new_members = [MENTION.format(i.first_name, i.id) for i in message.new_chat_members] + chat_id = message.chat.id - # Build the welcome message by using an emoji and the list we built above - text = MESSAGE.format(Emoji.SPARKLES, ", ".join(new_members)) + # Get the previous welcome message and members, if any + previous_welcome, previous_members = last_welcomes.pop(chat_id, (None, [])) - # Send the welcome message - message.reply(text, disable_web_page_preview=True) + # Delete the previous message, if exists + if previous_welcome: + previous_welcome.delete() + + # Build the new members list by using their first_name. Also append the previous members, if any + new_members = [USER.format(i.first_name) for i in message.new_chat_members] + previous_members + + # Build the welcome message by using an emoji and the list we created above + text = MESSAGE.format(", ".join(new_members)) + + # Actually send the welcome and save the new message and the new members list + last_welcomes[message.chat.id] = message.reply(text, disable_web_page_preview=True), new_members + + +@app.on_message(enabled_groups) +def reset(client, message): + # Don't make the bot delete the previous welcome in case someone talks in the middle + last_welcomes.pop(message.chat.id, None) app.run() # Automatically start() and idle() From 61b36898a4e96dc429efe7c5d6210f416e9df7d6 Mon Sep 17 00:00:00 2001 From: Dan <14043624+delivrance@users.noreply.github.com> Date: Mon, 10 Dec 2018 15:19:54 +0100 Subject: [PATCH 05/15] Fix chat username and session name --- examples/welcome_bot.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/welcome_bot.py b/examples/welcome_bot.py index 2598a802..4326ed6c 100644 --- a/examples/welcome_bot.py +++ b/examples/welcome_bot.py @@ -9,11 +9,11 @@ from pyrogram import Client, Emoji, Filters USER = "**{}**" MESSAGE = "{} Welcome to [Pyrogram](https://docs.pyrogram.ml/)'s group chat {{}}!".format(Emoji.SPARKLES) -app = Client("dan_prod") - -enabled_groups = Filters.chat("PyrogramLounge") +enabled_groups = Filters.chat("PyrogramChat") last_welcomes = {} +app = Client("my_account") + @app.on_message(enabled_groups & Filters.new_chat_members) def welcome(client, message): From c9ce95c9648c3288e5ea6d554fa748d11c3f9f8a Mon Sep 17 00:00:00 2001 From: Dan <14043624+delivrance@users.noreply.github.com> Date: Sat, 15 Dec 2018 08:14:04 +0100 Subject: [PATCH 06/15] Add 500 RANDOM_ID_DUPLICATE error --- compiler/error/source/500_INTERNAL_SERVER_ERROR.tsv | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/compiler/error/source/500_INTERNAL_SERVER_ERROR.tsv b/compiler/error/source/500_INTERNAL_SERVER_ERROR.tsv index 60d1b51a..d1c666c6 100644 --- a/compiler/error/source/500_INTERNAL_SERVER_ERROR.tsv +++ b/compiler/error/source/500_INTERNAL_SERVER_ERROR.tsv @@ -4,4 +4,5 @@ RPC_CALL_FAIL Telegram is having internal problems. Please try again later RPC_MCGET_FAIL Telegram is having internal problems. Please try again later PERSISTENT_TIMESTAMP_OUTDATED Telegram is having internal problems. Please try again later HISTORY_GET_FAILED Telegram is having internal problems. Please try again later -REG_ID_GENERATE_FAILED Telegram is having internal problems. Please try again later \ No newline at end of file +REG_ID_GENERATE_FAILED Telegram is having internal problems. Please try again later +RANDOM_ID_DUPLICATE Telegram is having internal problems. Please try again later \ No newline at end of file From 067b98853765ea6b18a078a1350288f1094ff544 Mon Sep 17 00:00:00 2001 From: Dan <14043624+delivrance@users.noreply.github.com> Date: Sat, 15 Dec 2018 08:33:27 +0100 Subject: [PATCH 07/15] Update 400 Bad Request errors --- compiler/error/source/400_BAD_REQUEST.tsv | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/compiler/error/source/400_BAD_REQUEST.tsv b/compiler/error/source/400_BAD_REQUEST.tsv index 382e521e..d330db1b 100644 --- a/compiler/error/source/400_BAD_REQUEST.tsv +++ b/compiler/error/source/400_BAD_REQUEST.tsv @@ -51,7 +51,7 @@ BOT_INLINE_DISABLED The inline feature of the bot is disabled INLINE_RESULT_EXPIRED The inline bot query expired INVITE_HASH_INVALID The invite link hash is invalid USER_ALREADY_PARTICIPANT The user is already a participant of this chat -TTL_MEDIA_INVALID This kind of media does not support self-destruction +TTL_MEDIA_INVALID The media does not support self-destruction MAX_ID_INVALID The max_id parameter is invalid CHANNEL_INVALID The channel parameter is invalid DC_ID_INVALID The dc_id parameter is invalid @@ -59,7 +59,7 @@ LIMIT_INVALID The limit parameter is invalid OFFSET_INVALID The offset parameter is invalid EMAIL_INVALID The email provided is invalid USER_IS_BOT A bot cannot send messages to other bots or to itself -WEBPAGE_CURL_FAILED Telegram could not fetch the provided URL +WEBPAGE_CURL_FAILED Telegram server could not fetch the provided URL STICKERSET_INVALID The requested sticker set is invalid PEER_FLOOD The method can't be used because your account is limited MEDIA_CAPTION_TOO_LONG The media caption is longer than 200 characters @@ -68,4 +68,11 @@ USER_CHANNELS_TOO_MUCH The user is already in too many channels or supergroups API_ID_PUBLISHED_FLOOD You are using an API key that is limited on the server side USER_NOT_PARTICIPANT The user is not a member of this chat CHANNEL_PRIVATE The channel/supergroup is not accessible -MESSAGE_IDS_EMPTY The requested message doesn't exist \ No newline at end of file +MESSAGE_IDS_EMPTY The requested message doesn't exist +WEBPAGE_MEDIA_EMPTY The URL doesn't contain any valid media +QUERY_ID_INVALID The callback query id is invalid +MEDIA_EMPTY The media is invalid +USER_IS_BLOCKED The user blocked you +YOU_BLOCKED_USER You blocked this user +ADMINS_TOO_MUCH The chat has too many administrators +BOTS_TOO_MUCH The chat has too many bots \ No newline at end of file From 49b18c600dd55b6217b90dface72b4111d783685 Mon Sep 17 00:00:00 2001 From: Dan <14043624+delivrance@users.noreply.github.com> Date: Sat, 15 Dec 2018 08:39:43 +0100 Subject: [PATCH 08/15] Add missing thumb for videos in albums. Fixes #169 --- pyrogram/client/methods/messages/send_media_group.py | 1 + 1 file changed, 1 insertion(+) diff --git a/pyrogram/client/methods/messages/send_media_group.py b/pyrogram/client/methods/messages/send_media_group.py index 5465c9f2..bc9f6971 100644 --- a/pyrogram/client/methods/messages/send_media_group.py +++ b/pyrogram/client/methods/messages/send_media_group.py @@ -108,6 +108,7 @@ class SendMediaGroup(BaseClient): peer=self.resolve_peer(chat_id), media=types.InputMediaUploadedDocument( file=self.save_file(i.media), + thumb=None if i.thumb is None else self.save_file(i.thumb), mime_type=mimetypes.types_map[".mp4"], attributes=[ types.DocumentAttributeVideo( From 9c917201046e95c951612b624529d02ba59138a7 Mon Sep 17 00:00:00 2001 From: Dan <14043624+delivrance@users.noreply.github.com> Date: Sat, 15 Dec 2018 08:50:08 +0100 Subject: [PATCH 09/15] Fix broken download_media progress args --- pyrogram/client/client.py | 2 +- pyrogram/client/methods/utilities/download_media.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pyrogram/client/client.py b/pyrogram/client/client.py index 119ecc11..8b0acd22 100644 --- a/pyrogram/client/client.py +++ b/pyrogram/client/client.py @@ -1214,7 +1214,7 @@ class Client(Methods, BaseClient): version: int = 0, size: int = None, progress: callable = None, - progress_args: tuple = None) -> str: + progress_args: tuple = ()) -> str: with self.media_sessions_lock: session = self.media_sessions.get(dc_id, None) diff --git a/pyrogram/client/methods/utilities/download_media.py b/pyrogram/client/methods/utilities/download_media.py index 1453539c..9b6c554a 100644 --- a/pyrogram/client/methods/utilities/download_media.py +++ b/pyrogram/client/methods/utilities/download_media.py @@ -28,7 +28,7 @@ class DownloadMedia(BaseClient): file_name: str = "", block: bool = True, progress: callable = None, - progress_args: tuple = None): + progress_args: tuple = ()): """Use this method to download the media from a Message. Args: From 4ba5e630349f693bf1a89995fde0617996b78209 Mon Sep 17 00:00:00 2001 From: Dan <14043624+delivrance@users.noreply.github.com> Date: Sat, 15 Dec 2018 08:51:20 +0100 Subject: [PATCH 10/15] Report offset instead of 0 in case file size is missing (for file_id) --- pyrogram/client/client.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pyrogram/client/client.py b/pyrogram/client/client.py index 8b0acd22..2094eb9c 100644 --- a/pyrogram/client/client.py +++ b/pyrogram/client/client.py @@ -1296,7 +1296,7 @@ class Client(Methods, BaseClient): offset += limit if progress: - progress(self, min(offset, size), size, *progress_args) + progress(self, min(offset, size) if size != 0 else offset, size, *progress_args) r = session.send( functions.upload.GetFile( @@ -1378,7 +1378,7 @@ class Client(Methods, BaseClient): offset += limit if progress: - progress(self, min(offset, size), size, *progress_args) + progress(self, min(offset, size) if size != 0 else offset, size, *progress_args) if len(chunk) < limit: break From 2ae8730b22462eba509ee400107099eaf82dfd98 Mon Sep 17 00:00:00 2001 From: Dan <14043624+delivrance@users.noreply.github.com> Date: Sat, 15 Dec 2018 08:53:22 +0100 Subject: [PATCH 11/15] Add Filters.via_bot to filter messages sent via inline bots --- pyrogram/client/filters/filters.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pyrogram/client/filters/filters.py b/pyrogram/client/filters/filters.py index 9ae15239..fa9eace3 100644 --- a/pyrogram/client/filters/filters.py +++ b/pyrogram/client/filters/filters.py @@ -172,6 +172,9 @@ class Filters: mentioned = create("Mentioned", lambda _, m: bool(m.mentioned)) """Filter messages containing mentions""" + via_bot = create("ViaBot", lambda _, m: bool(m.via_bot)) + """Filter messages sent via inline bots""" + service = create("Service", lambda _, m: bool(m.service)) """Filter service messages. A service message contains any of the following fields set From 6a9c7312ccf6daf56c8140e394b0cb7aeed0bc98 Mon Sep 17 00:00:00 2001 From: Dan <14043624+delivrance@users.noreply.github.com> Date: Sat, 15 Dec 2018 09:10:19 +0100 Subject: [PATCH 12/15] Document how decorated functions are modified --- pyrogram/client/methods/decorators/on_callback_query.py | 7 +++++++ pyrogram/client/methods/decorators/on_deleted_messages.py | 7 +++++++ pyrogram/client/methods/decorators/on_message.py | 7 +++++++ pyrogram/client/methods/decorators/on_raw_update.py | 7 +++++++ pyrogram/client/methods/decorators/on_user_status.py | 7 +++++++ 5 files changed, 35 insertions(+) diff --git a/pyrogram/client/methods/decorators/on_callback_query.py b/pyrogram/client/methods/decorators/on_callback_query.py index a7079236..51a6df2e 100644 --- a/pyrogram/client/methods/decorators/on_callback_query.py +++ b/pyrogram/client/methods/decorators/on_callback_query.py @@ -27,6 +27,13 @@ class OnCallbackQuery(BaseClient): callback queries. This does the same thing as :meth:`add_handler` using the :class:`CallbackQueryHandler`. + .. note:: + This decorator will wrap your defined function in a tuple consisting of *(Handler, group)*. + + To reference your own function after it has been decorated, you need to access + *my_function[0].callback*, that is, the *callback* field of Handler object which is the the + first element in the tuple. + Args: filters (:obj:`Filters `): Pass one or more filters to allow only a subset of callback queries to be passed diff --git a/pyrogram/client/methods/decorators/on_deleted_messages.py b/pyrogram/client/methods/decorators/on_deleted_messages.py index 2fd8f298..c23b7594 100644 --- a/pyrogram/client/methods/decorators/on_deleted_messages.py +++ b/pyrogram/client/methods/decorators/on_deleted_messages.py @@ -27,6 +27,13 @@ class OnDeletedMessages(BaseClient): deleted messages. This does the same thing as :meth:`add_handler` using the :class:`DeletedMessagesHandler`. + .. note:: + This decorator will wrap your defined function in a tuple consisting of *(Handler, group)*. + + To reference your own function after it has been decorated, you need to access + *my_function[0].callback*, that is, the *callback* field of Handler object which is the the + first element in the tuple. + Args: filters (:obj:`Filters `): Pass one or more filters to allow only a subset of messages to be passed diff --git a/pyrogram/client/methods/decorators/on_message.py b/pyrogram/client/methods/decorators/on_message.py index 690f8368..a098cfa2 100644 --- a/pyrogram/client/methods/decorators/on_message.py +++ b/pyrogram/client/methods/decorators/on_message.py @@ -27,6 +27,13 @@ class OnMessage(BaseClient): messages. This does the same thing as :meth:`add_handler` using the :class:`MessageHandler`. + .. note:: + This decorator will wrap your defined function in a tuple consisting of *(Handler, group)*. + + To reference your own function after it has been decorated, you need to access + *my_function[0].callback*, that is, the *callback* field of Handler object which is the the + first element in the tuple. + Args: filters (:obj:`Filters `): Pass one or more filters to allow only a subset of messages to be passed diff --git a/pyrogram/client/methods/decorators/on_raw_update.py b/pyrogram/client/methods/decorators/on_raw_update.py index 1391482f..52728e1c 100644 --- a/pyrogram/client/methods/decorators/on_raw_update.py +++ b/pyrogram/client/methods/decorators/on_raw_update.py @@ -26,6 +26,13 @@ class OnRawUpdate(BaseClient): raw updates. This does the same thing as :meth:`add_handler` using the :class:`RawUpdateHandler`. + .. note:: + This decorator will wrap your defined function in a tuple consisting of *(Handler, group)*. + + To reference your own function after it has been decorated, you need to access + *my_function[0].callback*, that is, the *callback* field of Handler object which is the the + first element in the tuple. + Args: group (``int``, *optional*): The group identifier, defaults to 0. diff --git a/pyrogram/client/methods/decorators/on_user_status.py b/pyrogram/client/methods/decorators/on_user_status.py index 5aa6f783..2ca41e56 100644 --- a/pyrogram/client/methods/decorators/on_user_status.py +++ b/pyrogram/client/methods/decorators/on_user_status.py @@ -27,6 +27,13 @@ class OnUserStatus(BaseClient): user status updates. This does the same thing as :meth:`add_handler` using the :class:`UserStatusHandler`. + .. note:: + This decorator will wrap your defined function in a tuple consisting of *(Handler, group)*. + + To reference your own function after it has been decorated, you need to access + *my_function[0].callback*, that is, the *callback* field of Handler object which is the the + first element in the tuple. + Args: filters (:obj:`Filters `): Pass one or more filters to allow only a subset of UserStatus updated to be passed in your function. From 001a067d82e9b31bfe853837371f49b2971cba96 Mon Sep 17 00:00:00 2001 From: Dan <14043624+delivrance@users.noreply.github.com> Date: Sat, 15 Dec 2018 09:50:35 +0100 Subject: [PATCH 13/15] Make start and stop methods return self to make chaining possible Suggestion by @CharlesBachman in Telegram --- pyrogram/client/client.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/pyrogram/client/client.py b/pyrogram/client/client.py index 2094eb9c..9235eb12 100644 --- a/pyrogram/client/client.py +++ b/pyrogram/client/client.py @@ -198,10 +198,9 @@ class Client(Methods, BaseClient): self.dispatcher = Dispatcher(self, workers) def __enter__(self): - self.start() - return self + return self.start() - def __exit__(self, exc_type, exc_val, exc_tb): + def __exit__(self, *args): self.stop() @property @@ -294,6 +293,8 @@ class Client(Methods, BaseClient): mimetypes.init() Syncer.add(self) + return self + def stop(self): """Use this method to manually stop the Client. Requires no parameters. @@ -331,6 +332,8 @@ class Client(Methods, BaseClient): self.is_started = False self.session.stop() + return self + def idle(self, stop_signals: tuple = (SIGINT, SIGTERM, SIGABRT)): """Blocks the program execution until one of the signals are received, then gently stop the Client by closing the underlying connection. From afb3f55d33f780d8ea65523e50ed09185fff0f78 Mon Sep 17 00:00:00 2001 From: Dan <14043624+delivrance@users.noreply.github.com> Date: Sat, 15 Dec 2018 11:10:03 +0100 Subject: [PATCH 14/15] Add USER_ADMIN_INVALID error --- compiler/error/source/400_BAD_REQUEST.tsv | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/compiler/error/source/400_BAD_REQUEST.tsv b/compiler/error/source/400_BAD_REQUEST.tsv index d330db1b..08db4c4f 100644 --- a/compiler/error/source/400_BAD_REQUEST.tsv +++ b/compiler/error/source/400_BAD_REQUEST.tsv @@ -75,4 +75,5 @@ MEDIA_EMPTY The media is invalid USER_IS_BLOCKED The user blocked you YOU_BLOCKED_USER You blocked this user ADMINS_TOO_MUCH The chat has too many administrators -BOTS_TOO_MUCH The chat has too many bots \ No newline at end of file +BOTS_TOO_MUCH The chat has too many bots +USER_ADMIN_INVALID The action requires admin privileges \ No newline at end of file From 70470360b1d8167a20134e56728a345cda65e212 Mon Sep 17 00:00:00 2001 From: Dan <14043624+delivrance@users.noreply.github.com> Date: Sat, 15 Dec 2018 11:10:25 +0100 Subject: [PATCH 15/15] Print account name when logging in the first time --- pyrogram/client/client.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pyrogram/client/client.py b/pyrogram/client/client.py index 9235eb12..bd132851 100644 --- a/pyrogram/client/client.py +++ b/pyrogram/client/client.py @@ -437,6 +437,8 @@ class Client(Methods, BaseClient): else: self.user_id = r.user.id + print("Logged in successfully as @{}".format(r.user.username)) + def authorize_user(self): phone_number_invalid_raises = self.phone_number is not None phone_code_invalid_raises = self.phone_code is not None @@ -621,7 +623,7 @@ class Client(Methods, BaseClient): self.password = None self.user_id = r.user.id - print("Login successful") + print("Logged in successfully as {}".format(r.user.first_name)) def fetch_peers(self, entities: list): for entity in entities: