mirror of
https://github.com/TeamPGM/pyrogram.git
synced 2024-11-23 07:19:36 +00:00
Add ProfileColor enum
This commit is contained in:
parent
5802ed8422
commit
c8688154a5
@ -28,6 +28,7 @@ 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 .sent_code_type import SentCodeType
|
||||
from .stories_privacy_rules import StoriesPrivacyRules
|
||||
from .user_status import UserStatus
|
||||
@ -45,6 +46,7 @@ __all__ = [
|
||||
'NextCodeType',
|
||||
'ParseMode',
|
||||
'PollType',
|
||||
'ProfileColor',
|
||||
'SentCodeType',
|
||||
'StoriesPrivacyRules',
|
||||
'UserStatus'
|
||||
|
47
pyrogram/enums/profile_color.py
Normal file
47
pyrogram/enums/profile_color.py
Normal file
@ -0,0 +1,47 @@
|
||||
# Pyrogram - Telegram MTProto API Client Library for Python
|
||||
# Copyright (C) 2017-present Dan <https://github.com/delivrance>
|
||||
#
|
||||
# This file is part of Pyrogram.
|
||||
#
|
||||
# Pyrogram 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.
|
||||
#
|
||||
# Pyrogram 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 Pyrogram. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
from .auto_name import AutoName
|
||||
|
||||
|
||||
class ProfileColor(AutoName):
|
||||
"""Profile color enumeration used in :obj:`~pyrogram.method.UpdateColor`."""
|
||||
|
||||
RED = 0
|
||||
ORANGE = 1
|
||||
VIOLET = 2
|
||||
GREEN = 3
|
||||
CYAN = 4
|
||||
BLUE = 5
|
||||
PINK = 6
|
||||
|
||||
RED_DARK_RED = 7
|
||||
ORANGE_DARK_ORANGE = 8
|
||||
VIOLET_DARK_VIOLET = 9
|
||||
GREEN_DARK_GREEN = 10
|
||||
CYAN_DARK_CYAN = 11
|
||||
BLUE_DARK_BLUE = 12
|
||||
PINK_DARK_PINK = 13
|
||||
|
||||
BLUE_WHITE_RED = 14
|
||||
ORANGE_WHITE_GREEN = 15
|
||||
GREEN_WHITE_RED = 16
|
||||
BLUE_WHITE_GREEN = 17
|
||||
BLUE_WHITE_PINK = 18
|
||||
VIOLET_WHITE_ORANGE = 19
|
||||
BLUE_WHITE_ORANGE = 20
|
@ -20,13 +20,14 @@ from typing import Union
|
||||
|
||||
import pyrogram
|
||||
from pyrogram import raw
|
||||
from pyrogram import enums
|
||||
from pyrogram import types
|
||||
|
||||
class UpdateColor:
|
||||
async def update_color(
|
||||
self: "pyrogram.Client",
|
||||
chat_id: Union[int, str],
|
||||
color: int,
|
||||
color: "enums.ProfileColor",
|
||||
background_emoji_id: int = None
|
||||
) -> "types.Chat":
|
||||
"""Update color
|
||||
@ -37,8 +38,8 @@ 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.ProfileColor`):
|
||||
Color type.
|
||||
|
||||
background_emoji_id (``int``, *optional*):
|
||||
Unique identifier of the custom emoji.
|
||||
|
@ -154,8 +154,8 @@ class Chat(Object):
|
||||
Available reactions in the chat.
|
||||
Returned only in :meth:`~pyrogram.Client.get_chat`.
|
||||
|
||||
color (``int``, *optional*)
|
||||
Chat color.
|
||||
color (:obj:`~pyrogram.enums.ProfileColor`, *optional*)
|
||||
Chat reply color.
|
||||
|
||||
background_emoji_id (``int``, *optional*)
|
||||
Chat background emoji id.
|
||||
@ -200,7 +200,7 @@ class Chat(Object):
|
||||
linked_chat: "types.Chat" = None,
|
||||
send_as_chat: "types.Chat" = None,
|
||||
available_reactions: Optional["types.ChatReactions"] = None,
|
||||
color: int = None,
|
||||
color: "enums.ProfileColor" = None,
|
||||
background_emoji_id: int = None
|
||||
):
|
||||
super().__init__(client)
|
||||
@ -262,7 +262,7 @@ 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),
|
||||
color=enums.ProfileColor(user.color) if getattr(user, "color", None) else None,
|
||||
background_emoji_id=getattr(user, "background_emoji_id", None),
|
||||
client=client
|
||||
)
|
||||
@ -318,7 +318,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),
|
||||
color=enums.ProfileColor(channel.color) if getattr(channel, "color", None) else None,
|
||||
background_emoji_id=getattr(channel, "background_emoji_id", None),
|
||||
client=client
|
||||
)
|
||||
|
@ -161,11 +161,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.
|
||||
color (:obj:`~pyrogram.enums.ProfileColor`, *optional*)
|
||||
User's reply color.
|
||||
|
||||
background_emoji_id (``int``, *optional*)
|
||||
Chat background emoji id.
|
||||
User's background emoji id.
|
||||
"""
|
||||
|
||||
def __init__(
|
||||
@ -200,7 +200,7 @@ class User(Object, Update):
|
||||
phone_number: str = None,
|
||||
photo: "types.ChatPhoto" = None,
|
||||
restrictions: List["types.Restriction"] = None,
|
||||
color: int = None,
|
||||
color: "enums.ProfileColor" = None,
|
||||
background_emoji_id: int = None
|
||||
):
|
||||
super().__init__(client)
|
||||
@ -280,7 +280,7 @@ 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),
|
||||
color=enums.ProfileColor(user.color) if getattr(user, "color", None) else None,
|
||||
background_emoji_id=getattr(user, "background_emoji_id", None),
|
||||
client=client
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user