mirror of
https://github.com/Mayuri-Chan/pyrofork.git
synced 2025-12-29 12:04:51 +00:00
[Pyrofork] Added color and background_emoji_id to User and Chat
Signed-off-by: wulan17 <wulan17@nusantararom.org>
This commit is contained in:
parent
83f39f6ac3
commit
3b6999c5e2
3 changed files with 30 additions and 4 deletions
|
|
@ -372,6 +372,6 @@ WEBPAGE_MEDIA_EMPTY The URL doesn't contain any valid media
|
|||
YOU_BLOCKED_USER You blocked this user
|
||||
STORIES_NEVER_CREATED You have never created any stories
|
||||
MEDIA_FILE_INVALID The provided media file is invalid
|
||||
CHANNEL_FORUM_MISSING
|
||||
TTL_PERIOD_INVALID TTL_PERIOD_INVALID
|
||||
CHANNEL_FORUM_MISSING The channel forum is missing
|
||||
TTL_PERIOD_INVALID The provided TTL period is invalid
|
||||
BOOSTS_REQUIRED Channel required more boost to upload a story
|
||||
|
|
|
|||
|
Can't render this file because it has a wrong number of fields in line 375.
|
|
|
@ -143,6 +143,12 @@ class Chat(Object):
|
|||
usernames (List of :obj:`~pyrogram.types.Username`, *optional*):
|
||||
List of all chat (fragment) usernames; for private chats, supergroups and channels.
|
||||
Returned only in :meth:`~pyrogram.Client.get_chat`.
|
||||
|
||||
color (``int``, *optional*)
|
||||
Chat color.
|
||||
|
||||
background_emoji_id (``int``, *optional*)
|
||||
Chat background emoji id.
|
||||
"""
|
||||
|
||||
def __init__(
|
||||
|
|
@ -179,7 +185,9 @@ class Chat(Object):
|
|||
linked_chat: "types.Chat" = None,
|
||||
send_as_chat: "types.Chat" = None,
|
||||
available_reactions: Optional["types.ChatReactions"] = None,
|
||||
usernames: List["types.Username"] = None
|
||||
usernames: List["types.Username"] = None,
|
||||
color: int = None,
|
||||
background_emoji_id: int = None
|
||||
):
|
||||
super().__init__(client)
|
||||
|
||||
|
|
@ -214,6 +222,8 @@ class Chat(Object):
|
|||
self.send_as_chat = send_as_chat
|
||||
self.available_reactions = available_reactions
|
||||
self.usernames = usernames
|
||||
self.color = color
|
||||
self.background_emoji_id = background_emoji_id
|
||||
|
||||
@property
|
||||
def full_name(self) -> str:
|
||||
|
|
@ -237,6 +247,8 @@ class Chat(Object):
|
|||
photo=types.ChatPhoto._parse(client, user.photo, peer_id, user.access_hash),
|
||||
restrictions=types.List([types.Restriction._parse(r) for r in user.restriction_reason]) or None,
|
||||
dc_id=getattr(getattr(user, "photo", None), "dc_id", None),
|
||||
color=getattr(user, "color", None),
|
||||
background_emoji_id=getattr(user, "background_emoji_id", None),
|
||||
client=client
|
||||
)
|
||||
|
||||
|
|
@ -298,6 +310,8 @@ class Chat(Object):
|
|||
members_count=getattr(channel, "participants_count", None),
|
||||
dc_id=getattr(getattr(channel, "photo", None), "dc_id", None),
|
||||
has_protected_content=getattr(channel, "noforwards", None),
|
||||
color=getattr(channel, "color", None),
|
||||
background_emoji_id=getattr(channel, "background_emoji_id", None),
|
||||
client=client
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -153,6 +153,12 @@ class User(Object, Update):
|
|||
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")``.
|
||||
|
||||
color (``int``, *optional*)
|
||||
Chat color.
|
||||
|
||||
background_emoji_id (``int``, *optional*)
|
||||
Chat background emoji id.
|
||||
"""
|
||||
|
||||
def __init__(
|
||||
|
|
@ -183,7 +189,9 @@ class User(Object, Update):
|
|||
dc_id: int = None,
|
||||
phone_number: str = None,
|
||||
photo: "types.ChatPhoto" = None,
|
||||
restrictions: List["types.Restriction"] = None
|
||||
restrictions: List["types.Restriction"] = None,
|
||||
color: int = None,
|
||||
background_emoji_id: int = None
|
||||
):
|
||||
super().__init__(client)
|
||||
|
||||
|
|
@ -212,6 +220,8 @@ class User(Object, Update):
|
|||
self.phone_number = phone_number
|
||||
self.photo = photo
|
||||
self.restrictions = restrictions
|
||||
self.color = color
|
||||
self.background_emoji_id = background_emoji_id
|
||||
|
||||
@property
|
||||
def full_name(self) -> str:
|
||||
|
|
@ -264,6 +274,8 @@ class User(Object, Update):
|
|||
phone_number=user.phone,
|
||||
photo=types.ChatPhoto._parse(client, user.photo, user.id, user.access_hash),
|
||||
restrictions=types.List([types.Restriction._parse(r) for r in user.restriction_reason]) or None,
|
||||
color=getattr(user, "color", None),
|
||||
background_emoji_id=getattr(user, "background_emoji_id", None),
|
||||
client=client
|
||||
)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue