mirror of
https://github.com/Mayuri-Chan/pyrofork.git
synced 2025-12-29 12:04:51 +00:00
Add reply color, profile color and some known error, and add support multiple reaction
Signed-off-by: Yasir Aris M <git@yasirdev.my.id> Signed-off-by: wulan17 <wulan17@nusantararom.org>
This commit is contained in:
parent
726a622892
commit
2543c0f9f4
13 changed files with 300 additions and 49 deletions
|
|
@ -443,6 +443,7 @@ def pyrogram_api():
|
|||
PeerUser
|
||||
PeerChannel
|
||||
BotInfo
|
||||
ChatColor
|
||||
""",
|
||||
messages_media="""
|
||||
Messages & Media
|
||||
|
|
|
|||
|
|
@ -70,6 +70,7 @@ CHAT_TOO_BIG The chat is too big for this action
|
|||
CODE_EMPTY The provided code is empty
|
||||
CODE_HASH_INVALID The provided code hash invalid
|
||||
CODE_INVALID The provided code is invalid (i.e. from email)
|
||||
COLOR_INVALID The provided color is invalid
|
||||
CONNECTION_API_ID_INVALID The provided API id is invalid
|
||||
CONNECTION_APP_VERSION_EMPTY App version is empty
|
||||
CONNECTION_DEVICE_MODEL_EMPTY The device model is empty
|
||||
|
|
@ -136,7 +137,8 @@ GAME_BOT_INVALID You cannot send that game with the current bot
|
|||
GEO_POINT_INVALID Invalid geo point provided
|
||||
GIF_CONTENT_TYPE_INVALID GIF content-type invalid
|
||||
GIF_ID_INVALID The provided gif/animation id is invalid
|
||||
GRAPH_INVALID_RELOAD Invalid graph token provided, please reload the stats and provide the updated token
|
||||
GIFT_SLUG_EXPIRED The gift slug is expired
|
||||
GRAPH_INVALID_RELOAD Invalid graph token provided,
|
||||
GRAPH_OUTDATED_RELOAD The graph data is outdated
|
||||
GROUPCALL_SSRC_DUPLICATE_MUCH Too many group call synchronization source duplicates
|
||||
GROUPED_MEDIA_INVALID The album contains invalid media
|
||||
|
|
|
|||
|
|
|
@ -4,6 +4,7 @@ CHANNEL_PUBLIC_GROUP_NA The channel/supergroup is not available
|
|||
CHAT_ADMIN_INVITE_REQUIRED You don't have rights to invite other users
|
||||
CHAT_ADMIN_REQUIRED The method requires chat admin privileges
|
||||
CHAT_FORBIDDEN You cannot write in this chat
|
||||
CHAT_GUEST_SEND_FORBIDDEN You need to join the discussion group before commentingr
|
||||
EDIT_BOT_INVITE_FORBIDDEN Bots' chat invite links can't be edited
|
||||
INLINE_BOT_REQUIRED The action must be performed through an inline bot callback
|
||||
MESSAGE_AUTHOR_REQUIRED You are not the author of this message
|
||||
|
|
|
|||
|
|
|
@ -1,10 +1,12 @@
|
|||
id message
|
||||
AUTH_KEY_DUPLICATED The same authorization key (session file) was used in more than one place simultaneously. You must delete your session file and log in again with your phone number or bot token
|
||||
CHANNEL_PRIVATE The channel/supergroup is not accessible
|
||||
CHANNEL_TOO_LARGE Сhannel is too large to be deleted. Contact support for removal
|
||||
FILEREF_UPGRADE_NEEDED The file reference has expired and you must use a refreshed one by obtaining the original media message
|
||||
FRESH_CHANGE_ADMINS_FORBIDDEN You were just elected admin, you can't add or modify other admins yet
|
||||
FRESH_CHANGE_PHONE_FORBIDDEN You can't change your phone number because your session was logged-in recently
|
||||
FRESH_RESET_AUTHORISATION_FORBIDDEN You can't terminate other authorized sessions because the current was logged-in recently
|
||||
GIFTCODE_NOT_ALLOWED Giftcode not allowed
|
||||
PHONE_NUMBER_INVALID The phone number is invalid
|
||||
PHONE_PASSWORD_FLOOD You have tried to log-in too many times
|
||||
STICKERSET_INVALID The sticker set is invalid
|
||||
|
|
|
|||
|
|
|
@ -29,6 +29,8 @@ from .messages_filter import MessagesFilter
|
|||
from .next_code_type import NextCodeType
|
||||
from .parse_mode import ParseMode
|
||||
from .poll_type import PollType
|
||||
from .profile_color import ProfileColor
|
||||
from .reply_color import ReplyColor
|
||||
from .sent_code_type import SentCodeType
|
||||
from .stories_privacy_rules import StoriesPrivacyRules
|
||||
from .story_privacy import StoryPrivacy
|
||||
|
|
@ -48,6 +50,8 @@ __all__ = [
|
|||
'NextCodeType',
|
||||
'ParseMode',
|
||||
'PollType',
|
||||
'ProfileColor',
|
||||
'ReplyColor',
|
||||
'SentCodeType',
|
||||
"StoriesPrivacyRules",
|
||||
"StoryPrivacy",
|
||||
|
|
|
|||
72
pyrogram/enums/profile_color.py
Normal file
72
pyrogram/enums/profile_color.py
Normal file
|
|
@ -0,0 +1,72 @@
|
|||
# Pyrofork - Telegram MTProto API Client Library for Python
|
||||
# Copyright (C) 2017-present Dan <https://github.com/delivrance>
|
||||
# Copyright (C) 2022-present Mayuri-Chan <https://github.com/Mayuri-Chan>
|
||||
#
|
||||
# This file is part of Pyrofork.
|
||||
#
|
||||
# Pyrofork is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Lesser General Public License as published
|
||||
# by the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# Pyrofork is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Lesser General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public License
|
||||
# along with Pyrofork. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
from .auto_name import AutoName
|
||||
|
||||
|
||||
class ProfileColor(AutoName):
|
||||
"""Profile color enumeration used in :meth:`~pyrogram.Client.update_color` and :obj:`~pyrogram.types.ChatColor`."""
|
||||
|
||||
RED = 0
|
||||
"Red color."
|
||||
|
||||
ORANGE = 1
|
||||
"Orange color."
|
||||
|
||||
VIOLET = 2
|
||||
"Violet color."
|
||||
|
||||
GREEN = 3
|
||||
"Green color."
|
||||
|
||||
CYAN = 4
|
||||
"Cyan color."
|
||||
|
||||
BLUE = 5
|
||||
"Blue color."
|
||||
|
||||
PINK = 6
|
||||
"Pink color."
|
||||
|
||||
GRAY = 7
|
||||
"Gray color."
|
||||
|
||||
RED_LIGHT_RED = 8
|
||||
"Red color with light red gradient."
|
||||
|
||||
ORANGE_LIGHT_ORANGE = 9
|
||||
"Orange color with light red gradient."
|
||||
|
||||
VIOLET_LIGHT_VIOLET = 10
|
||||
"Violet color with light violet gradient."
|
||||
|
||||
GREEN_LIGHT_GREEN = 11
|
||||
"Green color with light green gradien."
|
||||
|
||||
CYAN_LIGHT_CYAN = 12
|
||||
"Cyan color with light cyan gradient."
|
||||
|
||||
BLUE_LIGHT_BLUE = 13
|
||||
"Blue color with light blue gradient."
|
||||
|
||||
PINK_LIGHT_PINK = 14
|
||||
"Pink color with light pink gradient."
|
||||
|
||||
GRAY_LIGHT_GRAY = 15
|
||||
"Gray color with light gray gradient."
|
||||
94
pyrogram/enums/reply_color.py
Normal file
94
pyrogram/enums/reply_color.py
Normal file
|
|
@ -0,0 +1,94 @@
|
|||
# Pyrofork - Telegram MTProto API Client Library for Python
|
||||
# Copyright (C) 2017-present Dan <https://github.com/delivrance>
|
||||
# Copyright (C) 2022-present Mayuri-Chan <https://github.com/Mayuri-Chan>
|
||||
#
|
||||
# This file is part of Pyrofork.
|
||||
#
|
||||
# Pyrofork is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Lesser General Public License as published
|
||||
# by the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# Pyrofork is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Lesser General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public License
|
||||
# along with Pyrofork. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
from .auto_name import AutoName
|
||||
|
||||
|
||||
class ReplyColor(AutoName):
|
||||
"""Reply color enumeration used in :meth:`~pyrogram.Client.update_color` and :obj:`~pyrogram.types.ChatColor`."""
|
||||
|
||||
RED = 0
|
||||
"Red color."
|
||||
|
||||
ORANGE = 1
|
||||
"Orange color."
|
||||
|
||||
VIOLET = 2
|
||||
"Violet color."
|
||||
|
||||
GREEN = 3
|
||||
"Green color."
|
||||
|
||||
CYAN = 4
|
||||
"Cyan color."
|
||||
|
||||
BLUE = 5
|
||||
"Blue color."
|
||||
|
||||
PINK = 6
|
||||
"Pink color."
|
||||
|
||||
RED_DARK_RED = 7
|
||||
"Red color with dark red stripes."
|
||||
|
||||
ORANGE_DARK_ORANGE = 8
|
||||
"Orange color with dark orange stripes."
|
||||
|
||||
VIOLET_DARK_VIOLET = 9
|
||||
"Violet color with dark violet stripes."
|
||||
|
||||
GREEN_DARK_GREEN = 10
|
||||
"Green color with dark green stripes."
|
||||
|
||||
CYAN_DARK_CYAN = 11
|
||||
"Cyan color with dark cyan stripes."
|
||||
|
||||
BLUE_DARK_BLUE = 12
|
||||
"Blue color with dark blue stripes."
|
||||
|
||||
PINK_DARK_PINK = 13
|
||||
"Pink color with dark pink stripes."
|
||||
|
||||
BLUE_WHITE_RED = 14
|
||||
"Blue color with white and red stripes."
|
||||
|
||||
ORANGE_WHITE_GREEN = 15
|
||||
"Orange color with white and green stripes."
|
||||
|
||||
GREEN_WHITE_RED = 16
|
||||
"Green color with white and red stripes."
|
||||
|
||||
CYAN_WHITE_GREEN = 17
|
||||
"Cyan color with white and red green."
|
||||
|
||||
CYAN_YELLOW_PINK = 18
|
||||
"Cyan color with yellow and pink stripes."
|
||||
|
||||
VIOLET_YELLOW_ORANGE = 19
|
||||
"Violet color with yellow and orange stripes."
|
||||
|
||||
BLUE_WHITE_ORANGE = 20
|
||||
"Blue color with white and orange stripes."
|
||||
|
||||
DYNAMIC = 21
|
||||
"""Secret color that cannot be set.
|
||||
For now:
|
||||
Red - If you use Telegram desktop.
|
||||
Blue - If you are using Telegram android/ios.
|
||||
"""
|
||||
|
|
@ -20,18 +20,15 @@ from typing import Union
|
|||
|
||||
import pyrogram
|
||||
from pyrogram import raw
|
||||
from pyrogram import types
|
||||
|
||||
# account.updateColor flags: color:int background_emoji_id:flags.0?long = Bool;
|
||||
# channels.updateColor flags: channel:InputChannel color:int background_emoji_id:flags.0?long = Updates;
|
||||
from pyrogram import enums
|
||||
|
||||
class UpdateColor:
|
||||
async def update_color(
|
||||
self: "pyrogram.Client",
|
||||
chat_id: Union[int, str],
|
||||
color: int,
|
||||
background_emoji_id: int = None,
|
||||
) -> "types.Chat":
|
||||
color: Union["enums.ReplyColor", "enums.ProfileColor"],
|
||||
background_emoji_id: int = None
|
||||
) -> bool:
|
||||
"""Update color
|
||||
|
||||
.. include:: /_includes/usable-by/users.rst
|
||||
|
|
@ -40,41 +37,38 @@ class UpdateColor:
|
|||
chat_id (``int`` | ``str``):
|
||||
Unique identifier (int) or username (str) of the target chat.
|
||||
|
||||
color (``int``):
|
||||
Numeric color identifier.
|
||||
color (:obj:`~pyrogram.enums.ReplyColor` | :obj:`~pyrogram.enums.ProfileColor`):
|
||||
Color type.
|
||||
Profile color can only be set for the user.
|
||||
|
||||
background_emoji_id (``int``, *optional*):
|
||||
Unique identifier of the custom emoji.
|
||||
|
||||
Returns:
|
||||
:obj:`~pyrogram.types.Chat`: On success, a chat object is returned.
|
||||
``bool``: On success, in case the passed-in session is authorized, True is returned.
|
||||
|
||||
Example:
|
||||
.. code-block:: python
|
||||
|
||||
await app.update_color(chat_id, 1)
|
||||
await app.update_color(chat_id, enums.ReplyColor.RED)
|
||||
"""
|
||||
|
||||
peer = await self.resolve_peer(chat_id)
|
||||
|
||||
if isinstance(peer, raw.types.InputPeerSelf):
|
||||
await self.invoke(
|
||||
r = await self.invoke(
|
||||
raw.functions.account.UpdateColor(
|
||||
color=color,
|
||||
for_profile=isinstance(color, enums.ProfileColor),
|
||||
color=color.value,
|
||||
background_emoji_id=background_emoji_id
|
||||
)
|
||||
)
|
||||
|
||||
r = await self.invoke(raw.functions.users.GetUsers(id=[raw.types.InputPeerSelf()]))
|
||||
chat = r[0]
|
||||
else:
|
||||
r = await self.invoke(
|
||||
raw.functions.channels.UpdateColor(
|
||||
channel=peer,
|
||||
color=color,
|
||||
color=color.value,
|
||||
background_emoji_id=background_emoji_id
|
||||
)
|
||||
)
|
||||
chat = r.chats[0]
|
||||
|
||||
return types.Chat._parse_chat(self, chat)
|
||||
return bool(r)
|
||||
|
|
@ -16,7 +16,7 @@
|
|||
# You should have received a copy of the GNU Lesser General Public License
|
||||
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
from typing import Union
|
||||
from typing import Union, List
|
||||
|
||||
import pyrogram
|
||||
from pyrogram import raw
|
||||
|
|
@ -28,7 +28,7 @@ class SendReaction:
|
|||
chat_id: Union[int, str],
|
||||
message_id: int = None,
|
||||
story_id: int = None,
|
||||
emoji: str = "",
|
||||
emoji: Union[int, str, List[Union[int, str]]] = None,
|
||||
big: bool = False
|
||||
) -> bool:
|
||||
"""Send a reaction to a message.
|
||||
|
|
@ -45,9 +45,10 @@ class SendReaction:
|
|||
story_id (``int``, *optional*):
|
||||
Identifier of the story.
|
||||
|
||||
emoji (``str``, *optional*):
|
||||
emoji (``int`` | ``str`` | List of ``int`` | ``str``, *optional*):
|
||||
Reaction emoji.
|
||||
Pass "" as emoji (default) to retract the reaction.
|
||||
Pass None as emoji (default) to retract the reaction.
|
||||
Pass list of int or str to react multiple emojis.
|
||||
|
||||
big (``bool``, *optional*):
|
||||
Pass True to show a bigger and longer reaction.
|
||||
|
|
@ -64,16 +65,31 @@ class SendReaction:
|
|||
await app.send_reaction(chat_id, message_id=message_id, emoji="🔥")
|
||||
await app.send_reaction(chat_id, story_id=story_id, emoji="🔥")
|
||||
|
||||
# Send a multiple reactions
|
||||
await app.send_reaction(chat_id, message_id=message_id, emoji=["🔥", "❤️"])
|
||||
|
||||
# Retract a reaction
|
||||
await app.send_reaction(chat_id, message_id=message_id)
|
||||
await app.send_reaction(chat_id, story_id=story_id)
|
||||
"""
|
||||
if isinstance(emoji, list):
|
||||
emoji = [
|
||||
raw.types.ReactionCustomEmoji(document_id=i)
|
||||
if isinstance(i, int)
|
||||
else raw.types.ReactionEmoji(emoticon=i)
|
||||
for i in emoji
|
||||
] if emoji else None
|
||||
else:
|
||||
if isinstance(emoji, int):
|
||||
emoji = [raw.types.ReactionCustomEmoji(document_id=emoji)]
|
||||
else:
|
||||
emoji = [raw.types.ReactionEmoji(emoticon=emoji)] if emoji else None
|
||||
if message_id is not None:
|
||||
await self.invoke(
|
||||
raw.functions.messages.SendReaction(
|
||||
peer=await self.resolve_peer(chat_id),
|
||||
msg_id=message_id,
|
||||
reaction=[raw.types.ReactionEmoji(emoticon=emoji)] if emoji else None,
|
||||
reaction=emoji,
|
||||
big=big
|
||||
)
|
||||
)
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@
|
|||
|
||||
from .chat import Chat
|
||||
from .chat_admin_with_invite_links import ChatAdminWithInviteLinks
|
||||
from .chat_color import ChatColor
|
||||
from .chat_event import ChatEvent
|
||||
from .chat_event_filter import ChatEventFilter
|
||||
from .chat_invite_link import ChatInviteLink
|
||||
|
|
@ -67,6 +68,7 @@ __all__ = [
|
|||
"ChatInviteLink",
|
||||
"InviteLinkImporter",
|
||||
"ChatAdminWithInviteLinks",
|
||||
"ChatColor",
|
||||
"ForumTopic",
|
||||
"ForumTopicCreated",
|
||||
"ForumTopicClosed",
|
||||
|
|
|
|||
|
|
@ -144,11 +144,11 @@ class Chat(Object):
|
|||
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.
|
||||
reply_color (:obj:`~pyrogram.types.ChatColor`, *optional*)
|
||||
Chat reply color.
|
||||
|
||||
background_emoji_id (``int``, *optional*)
|
||||
Chat background emoji id.
|
||||
profile_color (:obj:`~pyrogram.types.ChatColor`, *optional*)
|
||||
Chat profile color.
|
||||
"""
|
||||
|
||||
def __init__(
|
||||
|
|
@ -186,8 +186,8 @@ class Chat(Object):
|
|||
send_as_chat: "types.Chat" = None,
|
||||
available_reactions: Optional["types.ChatReactions"] = None,
|
||||
usernames: List["types.Username"] = None,
|
||||
color: int = None,
|
||||
background_emoji_id: int = None
|
||||
reply_color: "types.ChatColor" = None,
|
||||
profile_color: "types.ChatColor" = None
|
||||
):
|
||||
super().__init__(client)
|
||||
|
||||
|
|
@ -222,8 +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
|
||||
self.reply_color = reply_color
|
||||
self.profile_color = profile_color
|
||||
|
||||
@property
|
||||
def full_name(self) -> str:
|
||||
|
|
@ -247,8 +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),
|
||||
reply_color=types.ChatColor._parse(getattr(user, "color", None)),
|
||||
profile_color=types.ChatColor._parse_profile_color(getattr(user, "profile_color", None)),
|
||||
client=client
|
||||
)
|
||||
|
||||
|
|
@ -310,8 +310,7 @@ 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),
|
||||
reply_color=types.ChatColor._parse(getattr(channel, "color", None)),
|
||||
client=client
|
||||
)
|
||||
|
||||
|
|
|
|||
64
pyrogram/types/user_and_chats/chat_color.py
Normal file
64
pyrogram/types/user_and_chats/chat_color.py
Normal file
|
|
@ -0,0 +1,64 @@
|
|||
# Pyrofork - Telegram MTProto API Client Library for Python
|
||||
# Copyright (C) 2022-present Mayuri-Chan <https://github.com/Mayuri-Chan>
|
||||
#
|
||||
# This file is part of Pyrofork.
|
||||
#
|
||||
# Pyrofork is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Lesser General Public License as published
|
||||
# by the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# Pyrofork is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Lesser General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public License
|
||||
# along with Pyrofork. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
from typing import Optional, Union
|
||||
|
||||
from pyrogram import raw
|
||||
from pyrogram import enums
|
||||
from ..object import Object
|
||||
|
||||
|
||||
class ChatColor(Object):
|
||||
"""Reply or profile color status.
|
||||
|
||||
Parameters:
|
||||
color (:obj:`~pyrogram.enums.ReplyColor` | :obj:`~pyrogram.enums.ProfileColor`, *optional*):
|
||||
Color type.
|
||||
|
||||
background_emoji_id (``int``, *optional*):
|
||||
Unique identifier of the custom emoji.
|
||||
"""
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
*,
|
||||
color: Union["enums.ReplyColor", "enums.ProfileColor"] = None,
|
||||
background_emoji_id: int = None
|
||||
):
|
||||
self.color = color
|
||||
self.background_emoji_id = background_emoji_id
|
||||
|
||||
@staticmethod
|
||||
def _parse(color: "raw.types.PeerColor" = None) -> Optional["ChatColor"]:
|
||||
if not color:
|
||||
return None
|
||||
|
||||
return ChatColor(
|
||||
color=enums.ReplyColor(color.color) if getattr(color, "color", None) else None,
|
||||
background_emoji_id=getattr(color, "background_emoji_id", None)
|
||||
)
|
||||
|
||||
@staticmethod
|
||||
def _parse_profile_color(color: "raw.types.PeerColor" = None) -> Optional["ChatColor"]:
|
||||
if not color:
|
||||
return None
|
||||
|
||||
return ChatColor(
|
||||
color=enums.ProfileColor(color.color) if getattr(color, "color", None) else None,
|
||||
background_emoji_id=getattr(color, "background_emoji_id", None)
|
||||
)
|
||||
|
|
@ -154,11 +154,11 @@ class User(Object, Update):
|
|||
``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.
|
||||
reply_color (:obj:`~pyrogram.types.ChatColor`, *optional*)
|
||||
Chat reply color.
|
||||
|
||||
profile_color (:obj:`~pyrogram.types.ChatColor`, *optional*)
|
||||
Chat profile color.
|
||||
"""
|
||||
|
||||
def __init__(
|
||||
|
|
@ -190,8 +190,8 @@ class User(Object, Update):
|
|||
phone_number: str = None,
|
||||
photo: "types.ChatPhoto" = None,
|
||||
restrictions: List["types.Restriction"] = None,
|
||||
color: int = None,
|
||||
background_emoji_id: int = None
|
||||
reply_color: "types.ChatColor" = None,
|
||||
profile_color: "types.ChatColor" = None
|
||||
):
|
||||
super().__init__(client)
|
||||
|
||||
|
|
@ -220,8 +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
|
||||
self.reply_color = reply_color
|
||||
self.profile_color = profile_color
|
||||
|
||||
@property
|
||||
def full_name(self) -> str:
|
||||
|
|
@ -274,8 +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),
|
||||
reply_color=types.ChatColor._parse(getattr(user, "color", None)),
|
||||
profile_color=types.ChatColor._parse_profile_color(getattr(user, "profile_color", None)),
|
||||
client=client
|
||||
)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue