-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 | ||
) -> Union["types.Message", List["types.Message"]]: | ||
"""Forward messages of any kind. | ||
|
||
|
@@ -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 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. | ||
|
@@ -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 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. pass parameter to raw.functions.messages.ForwardMessages |
||
) | ||
) | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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`): | ||
|
@@ -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) | ||
|
||
|
@@ -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 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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( | ||
|
@@ -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, | ||
|
There was a problem hiding this comment.
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