From be7f98976e037b8188a9ecfd001796c36ead72af Mon Sep 17 00:00:00 2001 From: Denis Date: Sun, 27 Jul 2025 02:09:34 +0300 Subject: [PATCH] =?UTF-8?q?=D0=9F=D0=BE=D0=BF=D1=80=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=D0=B0=20=D0=BB=D0=BE=D0=B3=D0=B8=D0=BA=D0=B0=20?= =?UTF-8?q?=D0=B7=D0=B0=D0=B4=D0=B5=D1=80=D0=B6=D0=BA=D0=B8=20=D0=BE=D1=82?= =?UTF-8?q?=D0=BF=D1=80=D0=B0=D0=B2=D0=BA=D0=B8=20=D1=81=D0=BE=D0=BE=D0=B1?= =?UTF-8?q?=D1=89=D0=B5=D0=BD=D0=B8=D1=8F=20=D1=81=20InputMedia,=20InputMe?= =?UTF-8?q?diaBuffer?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- maxapi/methods/send_message.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/maxapi/methods/send_message.py b/maxapi/methods/send_message.py index 135a103..0c51d0d 100644 --- a/maxapi/methods/send_message.py +++ b/maxapi/methods/send_message.py @@ -84,11 +84,15 @@ class SendMessage(BaseConnection): json['text'] = self.text + HAS_INPUT_MEDIA = False + if self.attachments: for att in self.attachments: - - if isinstance(att, InputMedia) or isinstance(att, InputMediaBuffer): + + if isinstance(att, (InputMedia, InputMediaBuffer)): + HAS_INPUT_MEDIA = True + input_media = await process_input_media( base_connection=self, bot=self.bot, @@ -108,7 +112,8 @@ class SendMessage(BaseConnection): if self.parse_mode is not None: json['format'] = self.parse_mode.value - await asyncio.sleep(self.bot.after_input_media_delay) + if HAS_INPUT_MEDIA: + await asyncio.sleep(self.bot.after_input_media_delay) response = None for attempt in range(self.ATTEMPTS_COUNT):