mirror of
https://github.com/TeamPGM/pyrogram.git
synced 2024-11-16 04:35:24 +00:00
Update some methods and types to new layer
This commit is contained in:
parent
2a3725e605
commit
ea531e6c42
@ -426,6 +426,7 @@ def pyrogram_api():
|
||||
Restriction
|
||||
EmojiStatus
|
||||
Folder
|
||||
ChatColor
|
||||
""",
|
||||
messages_media="""
|
||||
Messages & Media
|
||||
|
@ -29,6 +29,7 @@ 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 .user_status import UserStatus
|
||||
@ -47,6 +48,7 @@ __all__ = [
|
||||
'ParseMode',
|
||||
'PollType',
|
||||
'ProfileColor',
|
||||
'ReplyColor',
|
||||
'SentCodeType',
|
||||
'StoriesPrivacyRules',
|
||||
'UserStatus'
|
||||
|
@ -20,7 +20,7 @@ from .auto_name import AutoName
|
||||
|
||||
|
||||
class ProfileColor(AutoName):
|
||||
"""Profile color enumeration used in :meth:`~pyrogram.method.UpdateColor`."""
|
||||
"""Profile color enumeration used in :meth:`~pyrogram.method.UpdateColor` and :obj:`~pyrogram.types.ChatColor`."""
|
||||
|
||||
RED = 0
|
||||
ORANGE = 1
|
||||
@ -29,19 +29,13 @@ class ProfileColor(AutoName):
|
||||
CYAN = 4
|
||||
BLUE = 5
|
||||
PINK = 6
|
||||
GRAY = 7
|
||||
|
||||
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
|
||||
RED_LIGHT_RED = 8
|
||||
ORANGE_LIGHT_ORANGE = 9
|
||||
VIOLET_LIGHT_VIOLET = 10
|
||||
GREEN_LIGHT_GREEN = 11
|
||||
CYAN_LIGHT_CYAN = 12
|
||||
BLUE_LIGHT_BLUE = 13
|
||||
PINK_LIGHT_PINK = 14
|
||||
GRAY_LIGHT_GRAY = 15
|
||||
|
47
pyrogram/enums/reply_color.py
Normal file
47
pyrogram/enums/reply_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 ReplyColor(AutoName):
|
||||
"""Reply color enumeration used in :meth:`~pyrogram.method.UpdateColor` and :obj:`~pyrogram.types.ChatColor`."""
|
||||
|
||||
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
|
@ -35,7 +35,8 @@ class SendInlineBotResult:
|
||||
reply_to_chat_id: Union[int, str] = None,
|
||||
quote_text: str = None,
|
||||
parse_mode: Optional["enums.ParseMode"] = None,
|
||||
quote_entities: List["types.MessageEntity"] = None
|
||||
quote_entities: List["types.MessageEntity"] = None,
|
||||
quote_offset: int = None
|
||||
) -> "raw.base.Updates":
|
||||
"""Send an inline bot result.
|
||||
Bot results can be retrieved using :meth:`~pyrogram.Client.get_inline_bot_results`
|
||||
@ -68,16 +69,19 @@ class SendInlineBotResult:
|
||||
reply_to_chat_id (``int``, *optional*):
|
||||
If the message is a reply, ID of the original chat.
|
||||
|
||||
quote_text (``str``):
|
||||
quote_text (``str``, *optional*):
|
||||
Text of the quote to be sent.
|
||||
|
||||
parse_mode (:obj:`~pyrogram.enums.ParseMode`, *optional*):
|
||||
By default, texts are parsed using both Markdown and HTML styles.
|
||||
You can combine both syntaxes together.
|
||||
|
||||
quote_entities (List of :obj:`~pyrogram.types.MessageEntity`):
|
||||
quote_entities (List of :obj:`~pyrogram.types.MessageEntity`, *optional*):
|
||||
List of special entities that appear in quote text, which can be specified instead of *parse_mode*.
|
||||
|
||||
quote_offset (``int``, *optional*):
|
||||
Offset for quote in original message.
|
||||
|
||||
Returns:
|
||||
:obj:`~pyrogram.raw.base.Updates`: Currently, on success, a raw result is returned.
|
||||
|
||||
@ -100,7 +104,8 @@ class SendInlineBotResult:
|
||||
reply_to_peer=await self.resolve_peer(reply_to_chat_id) if reply_to_chat_id else None,
|
||||
message_thread_id=message_thread_id,
|
||||
quote_text=quote_text,
|
||||
quote_entities=quote_entities
|
||||
quote_entities=quote_entities,
|
||||
quote_offset=quote_offset,
|
||||
)
|
||||
)
|
||||
)
|
||||
|
@ -27,7 +27,7 @@ class UpdateColor:
|
||||
async def update_color(
|
||||
self: "pyrogram.Client",
|
||||
chat_id: Union[int, str],
|
||||
color: "enums.ProfileColor",
|
||||
color: Union["enums.ReplyColor", "enums.ProfileColor"],
|
||||
background_emoji_id: int = None
|
||||
) -> "types.Chat":
|
||||
"""Update color
|
||||
@ -38,7 +38,7 @@ class UpdateColor:
|
||||
chat_id (``int`` | ``str``):
|
||||
Unique identifier (int) or username (str) of the target chat.
|
||||
|
||||
color (:obj:`~pyrogram.enums.ProfileColor`):
|
||||
color (:obj:`~pyrogram.enums.ReplyColor` | :obj:`~pyrogram.enums.ProfileColor`):
|
||||
Color type.
|
||||
|
||||
background_emoji_id (``int``, *optional*):
|
||||
@ -58,6 +58,7 @@ class UpdateColor:
|
||||
if isinstance(peer, raw.types.InputPeerSelf):
|
||||
await self.invoke(
|
||||
raw.functions.account.UpdateColor(
|
||||
for_profile=isinstance(color, enums.ProfileColor),
|
||||
color=color.value,
|
||||
background_emoji_id=background_emoji_id
|
||||
)
|
||||
|
@ -38,6 +38,7 @@ class CopyMediaGroup:
|
||||
quote_text: str = None,
|
||||
parse_mode: Optional["enums.ParseMode"] = None,
|
||||
quote_entities: List["types.MessageEntity"] = None,
|
||||
quote_offset: int = None,
|
||||
schedule_date: datetime = None,
|
||||
invert_media: bool = None,
|
||||
) -> List["types.Message"]:
|
||||
@ -85,16 +86,19 @@ class CopyMediaGroup:
|
||||
reply_to_story_id (``int``, *optional*):
|
||||
Unique identifier for the target story.
|
||||
|
||||
quote_text (``str``):
|
||||
quote_text (``str``, *optional*):
|
||||
Text of the quote to be sent.
|
||||
|
||||
parse_mode (:obj:`~pyrogram.enums.ParseMode`, *optional*):
|
||||
By default, texts are parsed using both Markdown and HTML styles.
|
||||
You can combine both syntaxes together.
|
||||
|
||||
quote_entities (List of :obj:`~pyrogram.types.MessageEntity`):
|
||||
quote_entities (List of :obj:`~pyrogram.types.MessageEntity`, *optional*):
|
||||
List of special entities that appear in quote text, which can be specified instead of *parse_mode*.
|
||||
|
||||
quote_offset (``int``, *optional*):
|
||||
Offset for quote in original message.
|
||||
|
||||
schedule_date (:py:obj:`~datetime.datetime`, *optional*):
|
||||
Date when the message will be automatically sent.
|
||||
|
||||
@ -157,6 +161,7 @@ class CopyMediaGroup:
|
||||
reply_to_story_id=reply_to_story_id,
|
||||
quote_text=quote_text,
|
||||
quote_entities=quote_entities,
|
||||
quote_offset=quote_offset,
|
||||
),
|
||||
schedule_date=utils.datetime_to_timestamp(schedule_date),
|
||||
invert_media=invert_media
|
||||
|
@ -52,6 +52,7 @@ class SendAnimation:
|
||||
reply_to_story_id: int = None,
|
||||
quote_text: str = None,
|
||||
quote_entities: List["types.MessageEntity"] = None,
|
||||
quote_offset: int = None,
|
||||
schedule_date: datetime = None,
|
||||
protect_content: bool = None,
|
||||
reply_markup: Union[
|
||||
@ -133,12 +134,15 @@ class SendAnimation:
|
||||
reply_to_story_id (``int``, *optional*):
|
||||
Unique identifier for the target story.
|
||||
|
||||
quote_text (``str``):
|
||||
quote_text (``str``, *optional*):
|
||||
Text of the quote to be sent.
|
||||
|
||||
quote_entities (List of :obj:`~pyrogram.types.MessageEntity`):
|
||||
quote_entities (List of :obj:`~pyrogram.types.MessageEntity`, *optional*):
|
||||
List of special entities that appear in quote text, which can be specified instead of *parse_mode*.
|
||||
|
||||
quote_offset (``int``, *optional*):
|
||||
Offset for quote in original message.
|
||||
|
||||
schedule_date (:py:obj:`~datetime.datetime`, *optional*):
|
||||
Date when the message will be automatically sent.
|
||||
|
||||
@ -261,6 +265,7 @@ class SendAnimation:
|
||||
reply_to_story_id=reply_to_story_id,
|
||||
quote_text=quote_text,
|
||||
quote_entities=quote_entities,
|
||||
quote_offset=quote_offset,
|
||||
),
|
||||
random_id=self.rnd_id(),
|
||||
schedule_date=utils.datetime_to_timestamp(schedule_date),
|
||||
|
@ -50,6 +50,7 @@ class SendAudio:
|
||||
reply_to_story_id: int = None,
|
||||
quote_text: str = None,
|
||||
quote_entities: List["types.MessageEntity"] = None,
|
||||
quote_offset: int = None,
|
||||
schedule_date: datetime = None,
|
||||
protect_content: bool = None,
|
||||
reply_markup: Union[
|
||||
@ -126,12 +127,15 @@ class SendAudio:
|
||||
reply_to_story_id (``int``, *optional*):
|
||||
Unique identifier for the target story.
|
||||
|
||||
quote_text (``str``):
|
||||
quote_text (``str``, *optional*):
|
||||
Text of the quote to be sent.
|
||||
|
||||
quote_entities (List of :obj:`~pyrogram.types.MessageEntity`):
|
||||
quote_entities (List of :obj:`~pyrogram.types.MessageEntity`, *optional*):
|
||||
List of special entities that appear in quote text, which can be specified instead of *parse_mode*.
|
||||
|
||||
quote_offset (``int``, *optional*):
|
||||
Offset for quote in original message.
|
||||
|
||||
schedule_date (:py:obj:`~datetime.datetime`, *optional*):
|
||||
Date when the message will be automatically sent.
|
||||
|
||||
@ -248,6 +252,7 @@ class SendAudio:
|
||||
reply_to_story_id=reply_to_story_id,
|
||||
quote_text=quote_text,
|
||||
quote_entities=quote_entities,
|
||||
quote_offset=quote_offset,
|
||||
),
|
||||
random_id=self.rnd_id(),
|
||||
schedule_date=utils.datetime_to_timestamp(schedule_date),
|
||||
|
@ -38,6 +38,7 @@ class SendCachedMedia:
|
||||
reply_to_chat_id: Union[int, str] = None,
|
||||
reply_to_story_id: int = None,
|
||||
quote_text: str = None,
|
||||
quote_offset: int = None,
|
||||
quote_entities: List["types.MessageEntity"] = None,
|
||||
schedule_date: datetime = None,
|
||||
protect_content: bool = None,
|
||||
@ -92,12 +93,15 @@ class SendCachedMedia:
|
||||
reply_to_story_id (``int``, *optional*):
|
||||
Unique identifier for the target story.
|
||||
|
||||
quote_text (``str``):
|
||||
quote_text (``str``, *optional*):
|
||||
Text of the quote to be sent.
|
||||
|
||||
quote_entities (List of :obj:`~pyrogram.types.MessageEntity`):
|
||||
quote_entities (List of :obj:`~pyrogram.types.MessageEntity`, *optional*):
|
||||
List of special entities that appear in quote text, which can be specified instead of *parse_mode*.
|
||||
|
||||
quote_offset (``int``, *optional*):
|
||||
Offset for quote in original message.
|
||||
|
||||
schedule_date (:py:obj:`~datetime.datetime`, *optional*):
|
||||
Date when the message will be automatically sent.
|
||||
|
||||
@ -138,6 +142,7 @@ class SendCachedMedia:
|
||||
reply_to_story_id=reply_to_story_id,
|
||||
quote_text=quote_text,
|
||||
quote_entities=quote_entities,
|
||||
quote_offset=quote_offset,
|
||||
),
|
||||
random_id=self.rnd_id(),
|
||||
schedule_date=utils.datetime_to_timestamp(schedule_date),
|
||||
|
@ -41,6 +41,7 @@ class SendContact:
|
||||
quote_text: str = None,
|
||||
parse_mode: Optional["enums.ParseMode"] = None,
|
||||
quote_entities: List["types.MessageEntity"] = None,
|
||||
quote_offset: int = None,
|
||||
schedule_date: datetime = None,
|
||||
protect_content: bool = None,
|
||||
reply_markup: Union[
|
||||
@ -86,16 +87,19 @@ class SendContact:
|
||||
reply_to_chat_id (``int``, *optional*):
|
||||
If the message is a reply, ID of the original chat.
|
||||
|
||||
quote_text (``str``):
|
||||
quote_text (``str``, *optional*):
|
||||
Text of the quote to be sent.
|
||||
|
||||
parse_mode (:obj:`~pyrogram.enums.ParseMode`, *optional*):
|
||||
By default, texts are parsed using both Markdown and HTML styles.
|
||||
You can combine both syntaxes together.
|
||||
|
||||
quote_entities (List of :obj:`~pyrogram.types.MessageEntity`):
|
||||
quote_entities (List of :obj:`~pyrogram.types.MessageEntity`, *optional*):
|
||||
List of special entities that appear in quote text, which can be specified instead of *parse_mode*.
|
||||
|
||||
quote_offset (``int``, *optional*):
|
||||
Offset for quote in original message.
|
||||
|
||||
schedule_date (:py:obj:`~datetime.datetime`, *optional*):
|
||||
Date when the message will be automatically sent.
|
||||
|
||||
@ -133,6 +137,7 @@ class SendContact:
|
||||
reply_to_peer=await self.resolve_peer(reply_to_chat_id) if reply_to_chat_id else None,
|
||||
quote_text=quote_text,
|
||||
quote_entities=quote_entities,
|
||||
quote_offset=quote_offset,
|
||||
),
|
||||
random_id=self.rnd_id(),
|
||||
schedule_date=utils.datetime_to_timestamp(schedule_date),
|
||||
|
@ -37,6 +37,7 @@ class SendDice:
|
||||
quote_text: str = None,
|
||||
parse_mode: Optional["enums.ParseMode"] = None,
|
||||
quote_entities: List["types.MessageEntity"] = None,
|
||||
quote_offset: int = None,
|
||||
schedule_date: datetime = None,
|
||||
protect_content: bool = None,
|
||||
reply_markup: Union[
|
||||
@ -80,16 +81,19 @@ class SendDice:
|
||||
reply_to_story_id (``int``, *optional*):
|
||||
Unique identifier for the target story.
|
||||
|
||||
quote_text (``str``):
|
||||
quote_text (``str``, *optional*):
|
||||
Text of the quote to be sent.
|
||||
|
||||
parse_mode (:obj:`~pyrogram.enums.ParseMode`, *optional*):
|
||||
By default, texts are parsed using both Markdown and HTML styles.
|
||||
You can combine both syntaxes together.
|
||||
|
||||
quote_entities (List of :obj:`~pyrogram.types.MessageEntity`):
|
||||
quote_entities (List of :obj:`~pyrogram.types.MessageEntity`, *optional*):
|
||||
List of special entities that appear in quote text, which can be specified instead of *parse_mode*.
|
||||
|
||||
quote_offset (``int``, *optional*):
|
||||
Offset for quote in original message.
|
||||
|
||||
schedule_date (:py:obj:`~datetime.datetime`, *optional*):
|
||||
Date when the message will be automatically sent.
|
||||
|
||||
@ -130,6 +134,7 @@ class SendDice:
|
||||
reply_to_story_id=reply_to_story_id,
|
||||
quote_text=quote_text,
|
||||
quote_entities=quote_entities,
|
||||
quote_offset=quote_offset,
|
||||
),
|
||||
random_id=self.rnd_id(),
|
||||
schedule_date=utils.datetime_to_timestamp(schedule_date),
|
||||
|
@ -48,6 +48,7 @@ class SendDocument:
|
||||
reply_to_story_id: int = None,
|
||||
quote_text: str = None,
|
||||
quote_entities: List["types.MessageEntity"] = None,
|
||||
quote_offset: int = None,
|
||||
schedule_date: datetime = None,
|
||||
protect_content: bool = None,
|
||||
reply_markup: Union[
|
||||
@ -118,12 +119,15 @@ class SendDocument:
|
||||
reply_to_story_id (``int``, *optional*):
|
||||
Unique identifier for the target story.
|
||||
|
||||
quote_text (``str``):
|
||||
quote_text (``str``, *optional*):
|
||||
Text of the quote to be sent.
|
||||
|
||||
quote_entities (List of :obj:`~pyrogram.types.MessageEntity`):
|
||||
quote_entities (List of :obj:`~pyrogram.types.MessageEntity`, *optional*):
|
||||
List of special entities that appear in quote text, which can be specified instead of *parse_mode*.
|
||||
|
||||
quote_offset (``int``, *optional*):
|
||||
Offset for quote in original message.
|
||||
|
||||
schedule_date (:py:obj:`~datetime.datetime`, *optional*):
|
||||
Date when the message will be automatically sent.
|
||||
|
||||
@ -226,6 +230,7 @@ class SendDocument:
|
||||
reply_to_story_id=reply_to_story_id,
|
||||
quote_text=quote_text,
|
||||
quote_entities=quote_entities,
|
||||
quote_offset=quote_offset,
|
||||
),
|
||||
random_id=self.rnd_id(),
|
||||
schedule_date=utils.datetime_to_timestamp(schedule_date),
|
||||
|
@ -37,6 +37,7 @@ class SendLocation:
|
||||
quote_text: str = None,
|
||||
parse_mode: Optional["enums.ParseMode"] = None,
|
||||
quote_entities: List["types.MessageEntity"] = None,
|
||||
quote_offset: int = None,
|
||||
schedule_date: datetime = None,
|
||||
protect_content: bool = None,
|
||||
reply_markup: Union[
|
||||
@ -76,16 +77,19 @@ class SendLocation:
|
||||
reply_to_chat_id (``int``, *optional*):
|
||||
If the message is a reply, ID of the original chat.
|
||||
|
||||
quote_text (``str``):
|
||||
quote_text (``str``, *optional*):
|
||||
Text of the quote to be sent.
|
||||
|
||||
parse_mode (:obj:`~pyrogram.enums.ParseMode`, *optional*):
|
||||
By default, texts are parsed using both Markdown and HTML styles.
|
||||
You can combine both syntaxes together.
|
||||
|
||||
quote_entities (List of :obj:`~pyrogram.types.MessageEntity`):
|
||||
quote_entities (List of :obj:`~pyrogram.types.MessageEntity`, *optional*):
|
||||
List of special entities that appear in quote text, which can be specified instead of *parse_mode*.
|
||||
|
||||
quote_offset (``int``, *optional*):
|
||||
Offset for quote in original message.
|
||||
|
||||
schedule_date (:py:obj:`~datetime.datetime`, *optional*):
|
||||
Date when the message will be automatically sent.
|
||||
|
||||
@ -123,6 +127,7 @@ class SendLocation:
|
||||
reply_to_peer=await self.resolve_peer(reply_to_chat_id) if reply_to_chat_id else None,
|
||||
quote_text=quote_text,
|
||||
quote_entities=quote_entities,
|
||||
quote_offset=quote_offset,
|
||||
),
|
||||
random_id=self.rnd_id(),
|
||||
schedule_date=utils.datetime_to_timestamp(schedule_date),
|
||||
|
@ -51,6 +51,7 @@ class SendMediaGroup:
|
||||
quote_text: str = None,
|
||||
parse_mode: Optional["enums.ParseMode"] = None,
|
||||
quote_entities: List["types.MessageEntity"] = None,
|
||||
quote_offset: int = None,
|
||||
schedule_date: datetime = None,
|
||||
protect_content: bool = None,
|
||||
invert_media: bool = None,
|
||||
@ -85,16 +86,19 @@ class SendMediaGroup:
|
||||
reply_to_story_id (``int``, *optional*):
|
||||
Unique identifier for the target story.
|
||||
|
||||
quote_text (``str``):
|
||||
quote_text (``str``, *optional*):
|
||||
Text of the quote to be sent.
|
||||
|
||||
parse_mode (:obj:`~pyrogram.enums.ParseMode`, *optional*):
|
||||
By default, texts are parsed using both Markdown and HTML styles.
|
||||
You can combine both syntaxes together.
|
||||
|
||||
quote_entities (List of :obj:`~pyrogram.types.MessageEntity`):
|
||||
quote_entities (List of :obj:`~pyrogram.types.MessageEntity`, *optional*):
|
||||
List of special entities that appear in quote text, which can be specified instead of *parse_mode*.
|
||||
|
||||
quote_offset (``int``, *optional*):
|
||||
Offset for quote in original message.
|
||||
|
||||
schedule_date (:py:obj:`~datetime.datetime`, *optional*):
|
||||
Date when the message will be automatically sent.
|
||||
|
||||
@ -436,6 +440,7 @@ class SendMediaGroup:
|
||||
reply_to_story_id=reply_to_story_id,
|
||||
quote_text=quote_text,
|
||||
quote_entities=quote_entities,
|
||||
quote_offset=quote_offset,
|
||||
),
|
||||
schedule_date=utils.datetime_to_timestamp(schedule_date),
|
||||
noforwards=protect_content,
|
||||
|
@ -39,6 +39,7 @@ class SendMessage:
|
||||
reply_to_story_id: int = None,
|
||||
quote_text: str = None,
|
||||
quote_entities: List["types.MessageEntity"] = None,
|
||||
quote_offset: int = None,
|
||||
schedule_date: datetime = None,
|
||||
protect_content: bool = None,
|
||||
reply_markup: Union[
|
||||
@ -88,12 +89,15 @@ class SendMessage:
|
||||
reply_to_story_id (``int``, *optional*):
|
||||
Unique identifier for the target story.
|
||||
|
||||
quote_text (``str``):
|
||||
quote_text (``str``, *optional*):
|
||||
Text of the quote to be sent.
|
||||
|
||||
quote_entities (List of :obj:`~pyrogram.types.MessageEntity`):
|
||||
quote_entities (List of :obj:`~pyrogram.types.MessageEntity`, *optional*):
|
||||
List of special entities that appear in quote text, which can be specified instead of *parse_mode*.
|
||||
|
||||
quote_offset (``int``, *optional*):
|
||||
Offset for quote in original message.
|
||||
|
||||
schedule_date (:py:obj:`~datetime.datetime`, *optional*):
|
||||
Date when the message will be automatically sent.
|
||||
|
||||
@ -159,6 +163,7 @@ class SendMessage:
|
||||
reply_to_story_id=reply_to_story_id,
|
||||
quote_text=quote_text,
|
||||
quote_entities=quote_entities,
|
||||
quote_offset=quote_offset,
|
||||
),
|
||||
random_id=self.rnd_id(),
|
||||
schedule_date=utils.datetime_to_timestamp(schedule_date),
|
||||
|
@ -46,6 +46,7 @@ class SendPhoto:
|
||||
reply_to_story_id: int = None,
|
||||
quote_text: str = None,
|
||||
quote_entities: List["types.MessageEntity"] = None,
|
||||
quote_offset: int = None,
|
||||
schedule_date: datetime = None,
|
||||
protect_content: bool = None,
|
||||
reply_markup: Union[
|
||||
@ -109,12 +110,15 @@ class SendPhoto:
|
||||
reply_to_story_id (``int``, *optional*):
|
||||
Unique identifier for the target story.
|
||||
|
||||
quote_text (``str``):
|
||||
quote_text (``str``, *optional*):
|
||||
Text of the quote to be sent.
|
||||
|
||||
quote_entities (List of :obj:`~pyrogram.types.MessageEntity`):
|
||||
quote_entities (List of :obj:`~pyrogram.types.MessageEntity`, *optional*):
|
||||
List of special entities that appear in quote text, which can be specified instead of *parse_mode*.
|
||||
|
||||
quote_offset (``int``, *optional*):
|
||||
Offset for quote in original message.
|
||||
|
||||
schedule_date (:py:obj:`~datetime.datetime`, *optional*):
|
||||
Date when the message will be automatically sent.
|
||||
|
||||
@ -210,6 +214,7 @@ class SendPhoto:
|
||||
reply_to_story_id=reply_to_story_id,
|
||||
quote_text=quote_text,
|
||||
quote_entities=quote_entities,
|
||||
quote_offset=quote_offset,
|
||||
),
|
||||
random_id=self.rnd_id(),
|
||||
schedule_date=utils.datetime_to_timestamp(schedule_date),
|
||||
|
@ -48,6 +48,7 @@ class SendPoll:
|
||||
quote_text: str = None,
|
||||
parse_mode: Optional["enums.ParseMode"] = None,
|
||||
quote_entities: List["types.MessageEntity"] = None,
|
||||
quote_offset: int = None,
|
||||
schedule_date: datetime = None,
|
||||
reply_markup: Union[
|
||||
"types.InlineKeyboardMarkup",
|
||||
@ -129,16 +130,19 @@ class SendPoll:
|
||||
reply_to_chat_id (``int``, *optional*):
|
||||
If the message is a reply, ID of the original chat.
|
||||
|
||||
quote_text (``str``):
|
||||
quote_text (``str``, *optional*):
|
||||
Text of the quote to be sent.
|
||||
|
||||
parse_mode (:obj:`~pyrogram.enums.ParseMode`, *optional*):
|
||||
By default, texts are parsed using both Markdown and HTML styles.
|
||||
You can combine both syntaxes together.
|
||||
|
||||
quote_entities (List of :obj:`~pyrogram.types.MessageEntity`):
|
||||
quote_entities (List of :obj:`~pyrogram.types.MessageEntity`, *optional*):
|
||||
List of special entities that appear in quote text, which can be specified instead of *parse_mode*.
|
||||
|
||||
quote_offset (``int``, *optional*):
|
||||
Offset for quote in original message.
|
||||
|
||||
schedule_date (:py:obj:`~datetime.datetime`, *optional*):
|
||||
Date when the message will be automatically sent.
|
||||
|
||||
@ -190,6 +194,7 @@ class SendPoll:
|
||||
reply_to_peer=await self.resolve_peer(reply_to_chat_id) if reply_to_chat_id else None,
|
||||
quote_text=quote_text,
|
||||
quote_entities=quote_entities,
|
||||
quote_offset=quote_offset,
|
||||
),
|
||||
random_id=self.rnd_id(),
|
||||
schedule_date=utils.datetime_to_timestamp(schedule_date),
|
||||
|
@ -44,6 +44,7 @@ class SendSticker:
|
||||
quote_text: str = None,
|
||||
parse_mode: Optional["enums.ParseMode"] = None,
|
||||
quote_entities: List["types.MessageEntity"] = None,
|
||||
quote_offset: int = None,
|
||||
schedule_date: datetime = None,
|
||||
protect_content: bool = None,
|
||||
reply_markup: Union[
|
||||
@ -89,16 +90,19 @@ class SendSticker:
|
||||
reply_to_story_id (``int``, *optional*):
|
||||
Unique identifier for the target story.
|
||||
|
||||
quote_text (``str``):
|
||||
quote_text (``str``, *optional*):
|
||||
Text of the quote to be sent.
|
||||
|
||||
parse_mode (:obj:`~pyrogram.enums.ParseMode`, *optional*):
|
||||
By default, texts are parsed using both Markdown and HTML styles.
|
||||
You can combine both syntaxes together.
|
||||
|
||||
quote_entities (List of :obj:`~pyrogram.types.MessageEntity`):
|
||||
quote_entities (List of :obj:`~pyrogram.types.MessageEntity`, *optional*):
|
||||
List of special entities that appear in quote text, which can be specified instead of *parse_mode*.
|
||||
|
||||
quote_offset (``int``, *optional*):
|
||||
Offset for quote in original message.
|
||||
|
||||
schedule_date (:py:obj:`~datetime.datetime`, *optional*):
|
||||
Date when the message will be automatically sent.
|
||||
|
||||
@ -191,6 +195,7 @@ class SendSticker:
|
||||
reply_to_story_id=reply_to_story_id,
|
||||
quote_text=quote_text,
|
||||
quote_entities=quote_entities,
|
||||
quote_offset=quote_offset,
|
||||
),
|
||||
random_id=self.rnd_id(),
|
||||
schedule_date=utils.datetime_to_timestamp(schedule_date),
|
||||
|
@ -41,6 +41,7 @@ class SendVenue:
|
||||
quote_text: str = None,
|
||||
parse_mode: Optional["enums.ParseMode"] = None,
|
||||
quote_entities: List["types.MessageEntity"] = None,
|
||||
quote_offset: int = None,
|
||||
schedule_date: datetime = None,
|
||||
protect_content: bool = None,
|
||||
reply_markup: Union[
|
||||
@ -93,16 +94,19 @@ class SendVenue:
|
||||
reply_to_chat_id (``int``, *optional*):
|
||||
If the message is a reply, ID of the original chat.
|
||||
|
||||
quote_text (``str``):
|
||||
quote_text (``str``, *optional*):
|
||||
Text of the quote to be sent.
|
||||
|
||||
parse_mode (:obj:`~pyrogram.enums.ParseMode`, *optional*):
|
||||
By default, texts are parsed using both Markdown and HTML styles.
|
||||
You can combine both syntaxes together.
|
||||
|
||||
quote_entities (List of :obj:`~pyrogram.types.MessageEntity`):
|
||||
quote_entities (List of :obj:`~pyrogram.types.MessageEntity`, *optional*):
|
||||
List of special entities that appear in quote text, which can be specified instead of *parse_mode*.
|
||||
|
||||
quote_offset (``int``, *optional*):
|
||||
Offset for quote in original message.
|
||||
|
||||
schedule_date (:py:obj:`~datetime.datetime`, *optional*):
|
||||
Date when the message will be automatically sent.
|
||||
|
||||
@ -147,6 +151,7 @@ class SendVenue:
|
||||
reply_to_peer=await self.resolve_peer(reply_to_chat_id) if reply_to_chat_id else None,
|
||||
quote_text=quote_text,
|
||||
quote_entities=quote_entities,
|
||||
quote_offset=quote_offset,
|
||||
),
|
||||
random_id=self.rnd_id(),
|
||||
schedule_date=utils.datetime_to_timestamp(schedule_date),
|
||||
|
@ -53,6 +53,7 @@ class SendVideo:
|
||||
reply_to_story_id: int = None,
|
||||
quote_text: str = None,
|
||||
quote_entities: List["types.MessageEntity"] = None,
|
||||
quote_offset: int = None,
|
||||
schedule_date: datetime = None,
|
||||
protect_content: bool = None,
|
||||
reply_markup: Union[
|
||||
@ -139,12 +140,15 @@ class SendVideo:
|
||||
reply_to_story_id (``int``, *optional*):
|
||||
Unique identifier for the target story.
|
||||
|
||||
quote_text (``str``):
|
||||
quote_text (``str``, *optional*):
|
||||
Text of the quote to be sent.
|
||||
|
||||
quote_entities (List of :obj:`~pyrogram.types.MessageEntity`):
|
||||
quote_entities (List of :obj:`~pyrogram.types.MessageEntity`, *optional*):
|
||||
List of special entities that appear in quote text, which can be specified instead of *parse_mode*.
|
||||
|
||||
quote_offset (``int``, *optional*):
|
||||
Offset for quote in original message.
|
||||
|
||||
schedule_date (:py:obj:`~datetime.datetime`, *optional*):
|
||||
Date when the message will be automatically sent.
|
||||
|
||||
@ -267,6 +271,7 @@ class SendVideo:
|
||||
reply_to_story_id=reply_to_story_id,
|
||||
quote_text=quote_text,
|
||||
quote_entities=quote_entities,
|
||||
quote_offset=quote_offset,
|
||||
),
|
||||
random_id=self.rnd_id(),
|
||||
schedule_date=utils.datetime_to_timestamp(schedule_date),
|
||||
|
@ -46,6 +46,7 @@ class SendVideoNote:
|
||||
quote_text: str = None,
|
||||
parse_mode: Optional["enums.ParseMode"] = None,
|
||||
quote_entities: List["types.MessageEntity"] = None,
|
||||
quote_offset: int = None,
|
||||
schedule_date: datetime = None,
|
||||
protect_content: bool = None,
|
||||
reply_markup: Union[
|
||||
@ -103,16 +104,19 @@ class SendVideoNote:
|
||||
reply_to_story_id (``int``, *optional*):
|
||||
Unique identifier for the target story.
|
||||
|
||||
quote_text (``str``):
|
||||
quote_text (``str``, *optional*):
|
||||
Text of the quote to be sent.
|
||||
|
||||
parse_mode (:obj:`~pyrogram.enums.ParseMode`, *optional*):
|
||||
By default, texts are parsed using both Markdown and HTML styles.
|
||||
You can combine both syntaxes together.
|
||||
|
||||
quote_entities (List of :obj:`~pyrogram.types.MessageEntity`):
|
||||
quote_entities (List of :obj:`~pyrogram.types.MessageEntity`, *optional*):
|
||||
List of special entities that appear in quote text, which can be specified instead of *parse_mode*.
|
||||
|
||||
quote_offset (``int``, *optional*):
|
||||
Offset for quote in original message.
|
||||
|
||||
schedule_date (:py:obj:`~datetime.datetime`, *optional*):
|
||||
Date when the message will be automatically sent.
|
||||
|
||||
@ -215,6 +219,7 @@ class SendVideoNote:
|
||||
reply_to_story_id=reply_to_story_id,
|
||||
quote_text=quote_text,
|
||||
quote_entities=quote_entities,
|
||||
quote_offset=quote_offset,
|
||||
),
|
||||
random_id=self.rnd_id(),
|
||||
schedule_date=utils.datetime_to_timestamp(schedule_date),
|
||||
|
@ -46,6 +46,7 @@ class SendVoice:
|
||||
reply_to_story_id: int = None,
|
||||
quote_text: str = None,
|
||||
quote_entities: List["types.MessageEntity"] = None,
|
||||
quote_offset: int = None,
|
||||
schedule_date: datetime = None,
|
||||
protect_content: bool = None,
|
||||
reply_markup: Union[
|
||||
@ -104,11 +105,15 @@ class SendVoice:
|
||||
reply_to_story_id (``int``, *optional*):
|
||||
Unique identifier for the target story.
|
||||
|
||||
quote_text (``str``):
|
||||
quote_text (``str``, *optional*):
|
||||
Text of the quote to be sent.
|
||||
|
||||
quote_entities (List of :obj:`~pyrogram.types.MessageEntity`):
|
||||
quote_entities (List of :obj:`~pyrogram.types.MessageEntity`, *optional*):
|
||||
List of special entities that appear in quote text, which can be specified instead of *parse_mode*.
|
||||
|
||||
quote_offset (``int``, *optional*):
|
||||
Offset for quote in original message.
|
||||
|
||||
schedule_date (:py:obj:`~datetime.datetime`, *optional*):
|
||||
Date when the message will be automatically sent.
|
||||
|
||||
@ -209,6 +214,7 @@ class SendVoice:
|
||||
reply_to_story_id=reply_to_story_id,
|
||||
quote_text=quote_text,
|
||||
quote_entities=quote_entities,
|
||||
quote_offset=quote_offset,
|
||||
),
|
||||
random_id=self.rnd_id(),
|
||||
schedule_date=utils.datetime_to_timestamp(schedule_date),
|
||||
|
@ -145,7 +145,7 @@ class Message(Object, Update):
|
||||
edit_date (:py:obj:`~datetime.datetime`, *optional*):
|
||||
Date the message was last edited.
|
||||
|
||||
media_group_id (``str``, *optional*):
|
||||
media_group_id (``int``, *optional*):
|
||||
The unique identifier of a media message group this message belongs to.
|
||||
|
||||
author_signature (``str``, *optional*):
|
||||
@ -399,7 +399,7 @@ class Message(Object, Update):
|
||||
media: "enums.MessageMediaType" = None,
|
||||
invert_media: bool = None,
|
||||
edit_date: datetime = None,
|
||||
media_group_id: str = None,
|
||||
media_group_id: int = None,
|
||||
author_signature: str = None,
|
||||
has_protected_content: bool = None,
|
||||
has_media_spoiler: bool = None,
|
||||
|
@ -39,11 +39,23 @@ class Story(Object, Update):
|
||||
sender_chat (:obj:`~pyrogram.types.Chat`, *optional*):
|
||||
Sender of the story, sent on behalf of a chat.
|
||||
|
||||
date (:py:obj:`~datetime.datetime`, *optional*):
|
||||
Date the story was sent.
|
||||
|
||||
chat (:obj:`~pyrogram.types.Chat`, *optional*):
|
||||
Conversation the story belongs to.
|
||||
|
||||
date (:py:obj:`~datetime.datetime`, *optional*):
|
||||
Date the story was sent.
|
||||
forward_from (:obj:`~pyrogram.types.User`, *optional*):
|
||||
For forwarded stories, sender of the original story.
|
||||
|
||||
forward_sender_name (``str``, *optional*):
|
||||
For stories forwarded from users who have hidden their accounts, name of the user.
|
||||
|
||||
forward_from_chat (:obj:`~pyrogram.types.Chat`, *optional*):
|
||||
For stories forwarded from channels, information about the original channel.
|
||||
|
||||
forward_from_story_id (``int``, *optional*):
|
||||
For stories forwarded from channels, identifier of the original story in the channel.
|
||||
|
||||
expire_date (:py:obj:`~datetime.datetime`, *optional*):
|
||||
Date the story will be expired.
|
||||
@ -108,8 +120,12 @@ class Story(Object, Update):
|
||||
id: int,
|
||||
from_user: "types.User" = None,
|
||||
sender_chat: "types.Chat" = None,
|
||||
chat: "types.Chat" = None,
|
||||
date: datetime = None,
|
||||
chat: "types.Chat" = None,
|
||||
forward_from: "types.User" = None,
|
||||
forward_sender_name: str = None,
|
||||
forward_from_chat: "types.Chat" = None,
|
||||
forward_from_story_id: int = None,
|
||||
expire_date: datetime = None,
|
||||
media: "enums.MessageMediaType",
|
||||
has_protected_content: bool = None,
|
||||
@ -133,8 +149,12 @@ class Story(Object, Update):
|
||||
self.id = id
|
||||
self.from_user = from_user
|
||||
self.sender_chat = sender_chat
|
||||
self.chat = chat
|
||||
self.date = date
|
||||
self.chat = chat
|
||||
self.forward_from = forward_from
|
||||
self.forward_sender_name = forward_sender_name
|
||||
self.forward_from_chat = forward_from_chat
|
||||
self.forward_from_story_id = forward_from_story_id
|
||||
self.expire_date = expire_date
|
||||
self.media = media
|
||||
self.has_protected_content = has_protected_content
|
||||
@ -156,37 +176,17 @@ class Story(Object, Update):
|
||||
@staticmethod
|
||||
async def _parse(
|
||||
client: "pyrogram.Client",
|
||||
stories: raw.base.StoryItem,
|
||||
story: raw.types.StoryItem,
|
||||
users: dict,
|
||||
chats: dict,
|
||||
peer: Union["raw.types.PeerChannel", "raw.types.PeerUser"]
|
||||
) -> "Story":
|
||||
if isinstance(stories, raw.types.StoryItemSkipped):
|
||||
return await types.StorySkipped._parse(client, stories, users, chats, peer)
|
||||
if isinstance(stories, raw.types.StoryItemDeleted):
|
||||
return await types.StoryDeleted._parse(client, stories, users, chats, peer)
|
||||
if isinstance(story, raw.types.StoryItemSkipped):
|
||||
return await types.StorySkipped._parse(client, story, users, chats, peer)
|
||||
if isinstance(story, raw.types.StoryItemDeleted):
|
||||
return await types.StoryDeleted._parse(client, story, users, chats, peer)
|
||||
|
||||
entities = [e for e in (types.MessageEntity._parse(client, entity, {}) for entity in stories.entities) if e]
|
||||
|
||||
photo = None
|
||||
video = None
|
||||
from_user = None
|
||||
sender_chat = None
|
||||
chat = None
|
||||
privacy = None
|
||||
allowed_users = None
|
||||
disallowed_users = None
|
||||
media_type = None
|
||||
|
||||
if isinstance(stories.media, raw.types.MessageMediaPhoto):
|
||||
photo = types.Photo._parse(client, stories.media.photo, stories.media.ttl_seconds)
|
||||
media_type = enums.MessageMediaType.PHOTO
|
||||
else:
|
||||
doc = stories.media.document
|
||||
attributes = {type(i): i for i in doc.attributes}
|
||||
video_attributes = attributes.get(raw.types.DocumentAttributeVideo, None)
|
||||
video = types.Video._parse(client, doc, video_attributes, None)
|
||||
media_type = enums.MessageMediaType.VIDEO
|
||||
entities = [e for e in (types.MessageEntity._parse(client, entity, {}) for entity in story.entities) if e]
|
||||
|
||||
if isinstance(peer, raw.types.InputPeerSelf):
|
||||
r = await client.invoke(raw.functions.users.GetUsers(id=[raw.types.InputPeerSelf()]))
|
||||
@ -216,6 +216,43 @@ class Story(Object, Update):
|
||||
else:
|
||||
users.update({i.id: i for i in r})
|
||||
|
||||
forward_from = None
|
||||
forward_sender_name = None
|
||||
forward_from_chat = None
|
||||
forward_from_story_id = None
|
||||
|
||||
forward_header = story.fwd_from # type: raw.types.StoryFwdHeader
|
||||
|
||||
if forward_header and forward_header.from_id:
|
||||
raw_peer_id = utils.get_raw_peer_id(forward_header.from_id)
|
||||
peer_id = utils.get_peer_id(forward_header.from_id)
|
||||
|
||||
if peer_id > 0:
|
||||
forward_from = types.User._parse(client, users[raw_peer_id])
|
||||
else:
|
||||
forward_from_chat = types.Chat._parse_channel_chat(client, chats[raw_peer_id])
|
||||
forward_from_story_id = forward_header.story_id
|
||||
|
||||
photo = None
|
||||
video = None
|
||||
from_user = None
|
||||
sender_chat = None
|
||||
chat = None
|
||||
privacy = None
|
||||
allowed_users = None
|
||||
disallowed_users = None
|
||||
media_type = None
|
||||
|
||||
if isinstance(story.media, raw.types.MessageMediaPhoto):
|
||||
photo = types.Photo._parse(client, story.media.photo, story.media.ttl_seconds)
|
||||
media_type = enums.MessageMediaType.PHOTO
|
||||
else:
|
||||
doc = story.media.document
|
||||
attributes = {type(i): i for i in doc.attributes}
|
||||
video_attributes = attributes.get(raw.types.DocumentAttributeVideo, None)
|
||||
video = types.Video._parse(client, doc, video_attributes, None)
|
||||
media_type = enums.MessageMediaType.VIDEO
|
||||
|
||||
from_user = types.User._parse(client, users.get(peer_id, None))
|
||||
sender_chat = types.Chat._parse_channel_chat(client, chats[peer_id]) if not from_user else None
|
||||
chat = sender_chat if not from_user else types.Chat._parse_user_chat(client, users.get(peer_id, None))
|
||||
@ -227,7 +264,7 @@ class Story(Object, Update):
|
||||
raw.types.PrivacyValueDisallowAll: enums.StoriesPrivacyRules.SELECTED_USERS,
|
||||
}
|
||||
|
||||
for priv in stories.privacy:
|
||||
for priv in story.privacy:
|
||||
privacy = privacy_map.get(type(priv), None)
|
||||
|
||||
if isinstance(priv, raw.types.PrivacyValueAllowUsers):
|
||||
@ -240,25 +277,29 @@ class Story(Object, Update):
|
||||
disallowed_users = types.List(types.Chat._parse_chat_chat(client, chats.get(chat_id, None)) for chat_id in priv.chats)
|
||||
|
||||
return Story(
|
||||
id=stories.id,
|
||||
id=story.id,
|
||||
from_user=from_user,
|
||||
sender_chat=sender_chat,
|
||||
date=utils.timestamp_to_datetime(story.date),
|
||||
chat=chat,
|
||||
date=utils.timestamp_to_datetime(stories.date),
|
||||
expire_date=utils.timestamp_to_datetime(stories.expire_date),
|
||||
forward_from=forward_from,
|
||||
forward_sender_name=forward_sender_name,
|
||||
forward_from_chat=forward_from_chat,
|
||||
forward_from_story_id=forward_from_story_id,
|
||||
expire_date=utils.timestamp_to_datetime(story.expire_date),
|
||||
media=media_type,
|
||||
has_protected_content=stories.noforwards,
|
||||
has_protected_content=story.noforwards,
|
||||
photo=photo,
|
||||
video=video,
|
||||
edited=stories.edited,
|
||||
pinned=stories.pinned,
|
||||
public=stories.public,
|
||||
close_friends=stories.close_friends,
|
||||
contacts=stories.contacts,
|
||||
selected_contacts=stories.selected_contacts,
|
||||
caption=stories.caption,
|
||||
edited=story.edited,
|
||||
pinned=story.pinned,
|
||||
public=story.public,
|
||||
close_friends=story.close_friends,
|
||||
contacts=story.contacts,
|
||||
selected_contacts=story.selected_contacts,
|
||||
caption=story.caption,
|
||||
caption_entities=entities or None,
|
||||
views=types.StoryViews._parse(client, stories.views) if stories.views else None,
|
||||
views=types.StoryViews._parse(client, story.views) if story.views else None,
|
||||
privacy=privacy,
|
||||
allowed_users=allowed_users,
|
||||
disallowed_users=disallowed_users,
|
||||
|
@ -18,6 +18,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
|
||||
@ -57,6 +58,7 @@ __all__ = [
|
||||
"ChatInviteLink",
|
||||
"InviteLinkImporter",
|
||||
"ChatAdminWithInviteLinks",
|
||||
"ChatColor",
|
||||
"VideoChatStarted",
|
||||
"VideoChatEnded",
|
||||
"VideoChatMembersInvited",
|
||||
|
@ -154,11 +154,11 @@ class Chat(Object):
|
||||
Available reactions in the chat.
|
||||
Returned only in :meth:`~pyrogram.Client.get_chat`.
|
||||
|
||||
color (:obj:`~pyrogram.enums.ProfileColor`, *optional*)
|
||||
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__(
|
||||
@ -200,8 +200,8 @@ class Chat(Object):
|
||||
linked_chat: "types.Chat" = None,
|
||||
send_as_chat: "types.Chat" = None,
|
||||
available_reactions: Optional["types.ChatReactions"] = None,
|
||||
color: "enums.ProfileColor" = None,
|
||||
background_emoji_id: int = None
|
||||
reply_color: "types.ChatColor" = None,
|
||||
profile_color: "types.ChatColor" = None
|
||||
):
|
||||
super().__init__(client)
|
||||
|
||||
@ -240,8 +240,8 @@ class Chat(Object):
|
||||
self.linked_chat = linked_chat
|
||||
self.send_as_chat = send_as_chat
|
||||
self.available_reactions = available_reactions
|
||||
self.color = color
|
||||
self.background_emoji_id = background_emoji_id
|
||||
self.reply_color = reply_color
|
||||
self.profile_color = profile_color
|
||||
|
||||
@staticmethod
|
||||
def _parse_user_chat(client, user: raw.types.User) -> "Chat":
|
||||
@ -262,8 +262,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=enums.ProfileColor(user.color) if getattr(user, "color", None) else None,
|
||||
background_emoji_id=getattr(user, "background_emoji_id", None),
|
||||
reply_color=types.ChatColor._parse(getattr(user, "color", None)),
|
||||
profile_color=types.ChatColor._parse(getattr(user, "profile_color", None), for_profile=True),
|
||||
client=client
|
||||
)
|
||||
|
||||
@ -318,8 +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=enums.ProfileColor(channel.color) if getattr(channel, "color", None) else None,
|
||||
background_emoji_id=getattr(channel, "background_emoji_id", None),
|
||||
reply_color=types.ChatColor._parse(getattr(channel, "color", None)),
|
||||
client=client
|
||||
)
|
||||
|
||||
|
54
pyrogram/types/user_and_chats/chat_color.py
Normal file
54
pyrogram/types/user_and_chats/chat_color.py
Normal file
@ -0,0 +1,54 @@
|
||||
# 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 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, for_profile: bool = None) -> Optional["ChatColor"]:
|
||||
if not color:
|
||||
return None
|
||||
|
||||
return ChatColor(
|
||||
color=enums.ProfileColor(color.color) if for_profile else enums.ReplyColor(color.color) if color else None,
|
||||
background_emoji_id=getattr(color, "background_emoji_id", None)
|
||||
)
|
@ -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 (:obj:`~pyrogram.enums.ProfileColor`, *optional*)
|
||||
User's reply color.
|
||||
reply_color (:obj:`~pyrogram.types.ChatColor`, *optional*)
|
||||
Chat reply color.
|
||||
|
||||
background_emoji_id (``int``, *optional*)
|
||||
User's background emoji id.
|
||||
profile_color (:obj:`~pyrogram.types.ChatColor`, *optional*)
|
||||
Chat profile color.
|
||||
"""
|
||||
|
||||
def __init__(
|
||||
@ -200,8 +200,8 @@ class User(Object, Update):
|
||||
phone_number: str = None,
|
||||
photo: "types.ChatPhoto" = None,
|
||||
restrictions: List["types.Restriction"] = None,
|
||||
color: "enums.ProfileColor" = None,
|
||||
background_emoji_id: int = None
|
||||
reply_color: "types.ChatColor" = None,
|
||||
profile_color: "types.ChatColor" = None
|
||||
):
|
||||
super().__init__(client)
|
||||
|
||||
@ -233,8 +233,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:
|
||||
@ -280,8 +280,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=enums.ProfileColor(user.color) if getattr(user, "color", None) else None,
|
||||
background_emoji_id=getattr(user, "background_emoji_id", None),
|
||||
reply_color=types.ChatColor._parse(getattr(user, "color", None)),
|
||||
profile_color=types.ChatColor._parse(getattr(user, "profile_color", None), for_profile=True),
|
||||
client=client
|
||||
)
|
||||
|
||||
|
@ -327,6 +327,7 @@ def get_reply_to(
|
||||
reply_to_peer: Optional[raw.base.InputPeer] = None,
|
||||
quote_text: Optional[str] = None,
|
||||
quote_entities: Optional[List[raw.base.MessageEntity]] = None,
|
||||
quote_offset: Optional[int] = None,
|
||||
reply_to_story_id: Optional[int] = None
|
||||
) -> Optional[Union[raw.types.InputReplyToMessage, raw.types.InputReplyToStory]]:
|
||||
"""Get InputReply for reply_to argument"""
|
||||
@ -340,6 +341,7 @@ def get_reply_to(
|
||||
reply_to_peer_id=reply_to_peer,
|
||||
quote_text=quote_text,
|
||||
quote_entities=quote_entities,
|
||||
quote_offset=quote_offset,
|
||||
)
|
||||
|
||||
return None
|
||||
|
Loading…
Reference in New Issue
Block a user