Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add drop_author parameter in methods/.../forward_messages.py, types.Message.reactions edited #1235

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 7 additions & 2 deletions pyrogram/methods/messages/forward_messages.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ async def forward_messages(
message_ids: Union[int, Iterable[int]],
disable_notification: bool = None,
schedule_date: datetime = None,
protect_content: bool = None
protect_content: bool = None,
drop_author: bool = None
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

function parameter
if True - author will be hidden

) -> Union["types.Message", List["types.Message"]]:
"""Forward messages of any kind.

Expand Down Expand Up @@ -62,6 +63,9 @@ async def forward_messages(
protect_content (``bool``, *optional*):
Protects the contents of the sent message from forwarding and saving.

drop_author (``bool``, *optional*):
Forwards messages without quoting the original author
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

docstring for new param


Returns:
:obj:`~pyrogram.types.Message` | List of :obj:`~pyrogram.types.Message`: In case *message_ids* was not
a list, a single message is returned, otherwise a list of messages is returned.
Expand All @@ -87,7 +91,8 @@ async def forward_messages(
silent=disable_notification or None,
random_id=[self.rnd_id() for _ in message_ids],
schedule_date=utils.datetime_to_timestamp(schedule_date),
noforwards=protect_content
noforwards=protect_content,
drop_author=drop_author
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pass parameter to raw.functions.messages.ForwardMessages

)
)

Expand Down
14 changes: 10 additions & 4 deletions pyrogram/types/messages_and_media/message.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ class Message(Object, Update):
views (``int``, *optional*):
Channel post views.

forwards (``int``, *optional*):
forwards (``int``, *optional*):
Channel post forwards.

via_bot (:obj:`~pyrogram.types.User`):
Expand Down Expand Up @@ -384,7 +384,7 @@ def __init__(
"types.ReplyKeyboardRemove",
"types.ForceReply"
] = None,
reactions: List["types.Reaction"] = None
reactions: Union[List["types.Reaction"], "types.MessageReactions"] = None
):
super().__init__(client)

Expand Down Expand Up @@ -456,7 +456,13 @@ def __init__(
self.video_chat_ended = video_chat_ended
self.video_chat_members_invited = video_chat_members_invited
self.web_app_data = web_app_data
self.reactions = reactions
self._reactions = reactions

@property
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

изображение

def reactions(self) -> Optional["types.MessageReactions"]:
if isinstance(self._reactions, types.MessageReactions):
return self._reactions
return None

@staticmethod
async def _parse(
Expand Down Expand Up @@ -756,7 +762,7 @@ async def _parse(
from_user = types.User._parse(client, users.get(user_id, None))
sender_chat = types.Chat._parse(client, message, users, chats, is_chat=False) if not from_user else None

reactions = types.MessageReactions._parse(client, message.reactions)
reactions = types.MessageReactions._parse(client, message._reactions)

parsed_message = Message(
id=message.id,
Expand Down