Skip to content

Commit 00c2840

Browse files
fix: missing copy_message parameters
1 parent 5e333ac commit 00c2840

2 files changed

Lines changed: 50 additions & 40 deletions

File tree

pyrogram/methods/messages/copy_message.py

Lines changed: 47 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,11 @@
1818

1919
import logging
2020
from datetime import datetime
21-
from typing import Union, List, Optional
21+
from typing import TYPE_CHECKING, List, Optional, Union
2222

23-
import pyrogram
24-
from pyrogram import types, enums, utils
23+
if TYPE_CHECKING:
24+
import pyrogram
25+
from pyrogram import enums, types
2526

2627
log = logging.getLogger(__name__)
2728

@@ -32,26 +33,32 @@ async def copy_message(
3233
chat_id: Union[int, str],
3334
from_chat_id: Union[int, str],
3435
message_id: int,
35-
caption: str = None,
36+
caption: Optional[str] = None,
3637
parse_mode: Optional["enums.ParseMode"] = None,
37-
caption_entities: List["types.MessageEntity"] = None,
38-
disable_notification: bool = None,
39-
message_thread_id: int = None,
40-
reply_to_message_id: int = None,
41-
reply_to_chat_id: Union[int, str] = None,
42-
schedule_date: datetime = None,
43-
protect_content: bool = None,
44-
has_spoiler: bool = None,
45-
show_caption_above_media: bool = None,
46-
business_connection_id: str = None,
47-
allow_paid_broadcast: bool = None,
48-
paid_message_star_count: int = None,
49-
reply_markup: Union[
50-
"types.InlineKeyboardMarkup",
51-
"types.ReplyKeyboardMarkup",
52-
"types.ReplyKeyboardRemove",
53-
"types.ForceReply"
54-
] = None
38+
caption_entities: Optional[List["types.MessageEntity"]] = None,
39+
disable_notification: Optional[bool] = None,
40+
message_thread_id: Optional[int] = None,
41+
reply_parameters: Optional["types.ReplyParameters"] = None,
42+
schedule_date: Optional[datetime] = None,
43+
protect_content: Optional[bool] = None,
44+
has_spoiler: Optional[bool] = None,
45+
show_caption_above_media: Optional[bool] = None,
46+
business_connection_id: Optional[str] = None,
47+
allow_paid_broadcast: Optional[bool] = None,
48+
paid_message_star_count: Optional[int] = None,
49+
reply_markup: Optional[
50+
Union[
51+
"types.InlineKeyboardMarkup",
52+
"types.ReplyKeyboardMarkup",
53+
"types.ReplyKeyboardRemove",
54+
"types.ForceReply",
55+
]
56+
] = object,
57+
58+
reply_to_chat_id: Optional[Union[int, str]] = None,
59+
reply_to_message_id: Optional[int] = None,
60+
quote_text: Optional[str] = None,
61+
quote_entities: Optional[List["types.MessageEntity"]] = None,
5562
) -> "types.Message":
5663
"""Copy messages of any kind.
5764
@@ -94,31 +101,21 @@ async def copy_message(
94101
Unique identifier for the target message thread (topic) of the forum.
95102
For supergroups only.
96103
97-
reply_to_message_id (``int``, *optional*):
98-
If the message is a reply, ID of the original message.
99-
100-
reply_to_chat_id (``int``, *optional*):
101-
If the message is a reply, ID of the original chat.
104+
reply_parameters (:obj:`~pyrogram.types.ReplyParameters`, *optional*):
105+
Describes reply parameters for the message that is being sent.
102106
103107
schedule_date (:py:obj:`~datetime.datetime`, *optional*):
104108
Date when the message will be automatically sent.
105109
106110
protect_content (``bool``, *optional*):
107111
Protects the contents of the sent message from forwarding and saving.
108112
109-
has_spoiler (``bool``, *optional*):
110-
True, if the message media is covered by a spoiler animation.
111-
112113
show_caption_above_media (``bool``, *optional*):
113-
If True, caption must be shown above the message media.
114+
Pass True, if the caption must be shown above the message media.
114115
115116
business_connection_id (``str``, *optional*):
116117
Unique identifier of the business connection on behalf of which the message will be sent.
117118
118-
reply_markup (:obj:`~pyrogram.types.InlineKeyboardMarkup` | :obj:`~pyrogram.types.ReplyKeyboardMarkup` | :obj:`~pyrogram.types.ReplyKeyboardRemove` | :obj:`~pyrogram.types.ForceReply`, *optional*):
119-
Additional interface options. An object for an inline keyboard, custom reply keyboard,
120-
instructions to remove reply keyboard or to force a reply from the user.
121-
122119
allow_paid_broadcast (``bool``, *optional*):
123120
If True, you will be allowed to send up to 1000 messages per second.
124121
Ignoring broadcasting limits for a fee of 0.1 Telegram Stars per message.
@@ -128,6 +125,12 @@ async def copy_message(
128125
paid_message_star_count (``int``, *optional*):
129126
The number of Telegram Stars the user agreed to pay to send the messages.
130127
128+
reply_markup (:obj:`~pyrogram.types.InlineKeyboardMarkup` | :obj:`~pyrogram.types.ReplyKeyboardMarkup` | :obj:`~pyrogram.types.ReplyKeyboardRemove` | :obj:`~pyrogram.types.ForceReply`, *optional*):
129+
Additional interface options. An object for an inline keyboard, custom reply keyboard,
130+
instructions to remove reply keyboard or to force a reply from the user.
131+
If not specified, the original reply markup is kept.
132+
Pass None to remove the reply markup.
133+
131134
Returns:
132135
:obj:`~pyrogram.types.Message`: On success, the copied message is returned.
133136
@@ -138,7 +141,9 @@ async def copy_message(
138141
await app.copy_message(to_chat, from_chat, 123)
139142
140143
"""
141-
message: types.Message = await self.get_messages(chat_id=from_chat_id, message_ids=message_id)
144+
message: types.Message = await self.get_messages(
145+
chat_id=from_chat_id, message_ids=message_id
146+
)
142147

143148
return await message.copy(
144149
chat_id=chat_id,
@@ -147,14 +152,17 @@ async def copy_message(
147152
caption_entities=caption_entities,
148153
disable_notification=disable_notification,
149154
message_thread_id=message_thread_id,
150-
reply_to_message_id=reply_to_message_id,
151-
reply_to_chat_id=reply_to_chat_id,
155+
reply_parameters=reply_parameters,
152156
schedule_date=schedule_date,
153157
protect_content=protect_content,
154158
has_spoiler=has_spoiler,
155159
show_caption_above_media=show_caption_above_media,
160+
business_connection_id=business_connection_id,
156161
allow_paid_broadcast=allow_paid_broadcast,
157162
paid_message_star_count=paid_message_star_count,
158163
reply_markup=reply_markup,
159-
business_connection_id=business_connection_id
164+
reply_to_chat_id=reply_to_chat_id,
165+
reply_to_message_id=reply_to_message_id,
166+
quote_text=quote_text,
167+
quote_entities=quote_entities,
160168
)

pyrogram/types/authorization/phone_number_authentication_settings.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,9 @@ def write(self):
7979
current_number=self.is_current_phone_number,
8080
allow_app_hash=self.allow_sms_retriever_api,
8181
allow_missed_call=self.allow_missed_call,
82-
allow_firebase=bool(self.firebase_authentication_settings),
82+
allow_firebase=bool(self.firebase_authentication_settings)
83+
if self.firebase_authentication_settings is not None
84+
else None,
8385
unknown_number=self.has_unknown_phone_number,
8486
logout_tokens=self.authentication_tokens,
8587
token=getattr(self.firebase_authentication_settings, "device_token", None),

0 commit comments

Comments
 (0)