From d1d486507c75ce335a5179bfb54c67e735cf1c30 Mon Sep 17 00:00:00 2001 From: KurimuzonAkuma Date: Fri, 2 Aug 2024 12:14:52 +0300 Subject: [PATCH] Add missing attributes to User class --- pyrogram/types/user_and_chats/user.py | 72 +++++++++++++++++++++++---- 1 file changed, 63 insertions(+), 9 deletions(-) diff --git a/pyrogram/types/user_and_chats/user.py b/pyrogram/types/user_and_chats/user.py index d0169dce..45702f1b 100644 --- a/pyrogram/types/user_and_chats/user.py +++ b/pyrogram/types/user_and_chats/user.py @@ -121,9 +121,6 @@ class User(Object, Update): last_name (``str``, *optional*): User's or bot's last name. - full_name (``str``, *property*): - Full name of the other party in a private chat, for private chats and bots. - status (:obj:`~pyrogram.enums.UserStatus`, *optional*): User's last seen & online status. ``None``, for bots. @@ -161,20 +158,50 @@ class User(Object, Update): The list of reasons why this bot might be unavailable to some users. This field is available only in case *is_restricted* is True. - mention (``str``, *property*): - Generate a text mention for this user. - You can use ``user.mention()`` to mention the user using their first name (styled using html), or - ``user.mention("another name")`` for a custom name. To choose a different style - ("html" or "md"/"markdown") use ``user.mention(style="md")``. - reply_color (:obj:`~pyrogram.types.ChatColor`, *optional*): Chat reply color. profile_color (:obj:`~pyrogram.types.ChatColor`, *optional*): Chat profile color. + added_to_attachment_menu (``bool``, *optional*): + True, if this user added the bot to the attachment menu. + + active_users_count (``int``, *optional*): + The number of recently (monthly) active users of the bot. + + inline_need_location (``bool``, *optional*): + True, if the bot supports inline `user location `_ requests. Returned only in get_me. + + inline_query_placeholder (``str``, *optional*): + Placeholder for inline queries (displayed on the application input field). + + can_be_edited (``bool``, *optional*): + True, if the current user can edit this bot's profile picture. + + can_be_added_to_attachment_menu (``bool``, *optional*): + True, if the bot can be added to attachment or side menu. + + can_join_groups (``bool``, *optional*): + True, if the bot can be invited to groups. Returned only in get_me. + + can_read_all_group_messages (``bool``, *optional*): + True, if privacy mode is disabled for the bot. Returned only in get_me. + + has_main_web_app (``bool``, *optional*): + True, if the bot has a main Web App. Returned only in get_me. + raw (:obj:`~pyrogram.raw.base.User` | :obj:`~pyrogram.raw.base.UserStatus`, *optional*): The raw user or user status object, as received from the Telegram API. + + mention (``str``, *property*): + Generate a text mention for this user. + You can use ``user.mention()`` to mention the user using their first name (styled using html), or + ``user.mention("another name")`` for a custom name. To choose a different style + ("html" or "md"/"markdown") use ``user.mention(style="md")``. + + full_name (``str``, *property*): + Full name of the other party in a private chat, for private chats and bots. """ def __init__( @@ -213,6 +240,15 @@ class User(Object, Update): restrictions: List["types.Restriction"] = None, reply_color: "types.ChatColor" = None, profile_color: "types.ChatColor" = None, + added_to_attachment_menu: bool = None, + active_users_count: int = None, + inline_need_location: bool = None, + inline_query_placeholder: str = None, + can_be_edited: bool = None, + can_be_added_to_attachment_menu: bool = None, + can_join_groups: bool = None, + can_read_all_group_messages: bool = None, + has_main_web_app: bool = None, raw: Union["raw.base.User", "raw.base.UserStatus"] = None ): super().__init__(client) @@ -249,6 +285,15 @@ class User(Object, Update): self.restrictions = restrictions self.reply_color = reply_color self.profile_color = profile_color + self.added_to_attachment_menu = added_to_attachment_menu + self.active_users_count = active_users_count + self.inline_need_location = inline_need_location + self.inline_query_placeholder = inline_query_placeholder + self.can_be_edited = can_be_edited + self.can_be_added_to_attachment_menu = can_be_added_to_attachment_menu + self.can_join_groups = can_join_groups + self.can_read_all_group_messages = can_read_all_group_messages + self.has_main_web_app = has_main_web_app self.raw = raw @property @@ -299,6 +344,15 @@ class User(Object, Update): restrictions=types.List([types.Restriction._parse(r) for r in user.restriction_reason]) or None, reply_color=types.ChatColor._parse(getattr(user, "color", None)), profile_color=types.ChatColor._parse_profile_color(getattr(user, "profile_color", None)), + added_to_attachment_menu=getattr(user, "attach_menu_enabled", None), + active_users_count=getattr(user, "bot_active_users", None), + inline_need_location=getattr(user, "bot_inline_geo", None), + inline_query_placeholder=getattr(user, "bot_inline_placeholder", None), + can_be_edited=getattr(user, "bot_can_edit", None), + can_be_added_to_attachment_menu=getattr(user, "bot_attach_menu", None), + can_join_groups=getattr(user, "bot_nochats", None), + can_read_all_group_messages=getattr(user, "bot_chat_history", None), + has_main_web_app=getattr(user, "bot_has_main_app", None), raw=user, client=client )