|
16 | 16 | # You should have received a copy of the GNU Lesser General Public License |
17 | 17 | # along with Pyrogram. If not, see <http://www.gnu.org/licenses/>. |
18 | 18 |
|
| 19 | +import logging |
19 | 20 | import os |
20 | 21 | import re |
21 | 22 | from datetime import datetime |
22 | 23 | from typing import Union, BinaryIO, List, Optional, Callable |
23 | 24 |
|
24 | 25 | import pyrogram |
25 | | -from pyrogram import StopTransmission, enums |
26 | | -from pyrogram import raw |
27 | | -from pyrogram import types |
28 | | -from pyrogram import utils |
| 26 | +from pyrogram import StopTransmission, enums, raw, types, utils |
29 | 27 | from pyrogram.errors import FilePartMissing |
30 | 28 | from pyrogram.file_id import FileType |
31 | 29 | from .inline_session import get_session |
32 | 30 |
|
| 31 | +log = logging.getLogger(__name__) |
| 32 | + |
33 | 33 |
|
34 | 34 | class SendAnimation: |
35 | 35 | async def send_animation( |
@@ -59,6 +59,7 @@ async def send_animation( |
59 | 59 | "types.ReplyKeyboardRemove", |
60 | 60 | "types.ForceReply" |
61 | 61 | ] = None, |
| 62 | + reply_to_message_id: int = None, |
62 | 63 | progress: Callable = None, |
63 | 64 | progress_args: tuple = () |
64 | 65 | ) -> Optional["types.Message"]: |
@@ -191,6 +192,20 @@ async def progress(current, total): |
191 | 192 | # Send self-destructing animation message |
192 | 193 | await app.send_animation("me", "animation.gif", ttl_seconds=10) |
193 | 194 | """ |
| 195 | + |
| 196 | + if reply_to_message_id and reply_parameters: |
| 197 | + raise ValueError( |
| 198 | + "Parameters `reply_to_message_id` and `reply_parameters` are mutually " |
| 199 | + "exclusive." |
| 200 | + ) |
| 201 | + |
| 202 | + if reply_to_message_id is not None: |
| 203 | + log.warning( |
| 204 | + "This property is deprecated. " |
| 205 | + "Please use reply_parameters instead" |
| 206 | + ) |
| 207 | + reply_parameters = types.ReplyParameters(message_id=reply_to_message_id) |
| 208 | + |
194 | 209 | file = None |
195 | 210 |
|
196 | 211 | try: |
@@ -248,7 +263,7 @@ async def progress(current, total): |
248 | 263 | ttl_seconds=ttl_seconds |
249 | 264 | ) |
250 | 265 |
|
251 | | - reply_to = await utils.get_reply_head_fm( |
| 266 | + reply_to = await utils._get_reply_message_parameters( |
252 | 267 | self, |
253 | 268 | message_thread_id, |
254 | 269 | reply_parameters |
|
0 commit comments