From 8c43dccf7949461d02e5e790d9829555172f549f Mon Sep 17 00:00:00 2001 From: evgfilim1 Date: Sat, 31 Oct 2020 17:23:08 +0500 Subject: [PATCH] Fix unsupported parse_mode in some methods --- aiogram/api/methods/edit_message_text.py | 3 ++- aiogram/api/methods/send_animation.py | 3 ++- aiogram/api/methods/send_audio.py | 3 ++- aiogram/api/methods/send_document.py | 3 ++- aiogram/api/methods/send_photo.py | 3 ++- aiogram/api/methods/send_video.py | 3 ++- aiogram/api/methods/send_voice.py | 3 ++- 7 files changed, 14 insertions(+), 7 deletions(-) diff --git a/aiogram/api/methods/edit_message_text.py b/aiogram/api/methods/edit_message_text.py index d30fc82e..52ca7d51 100644 --- a/aiogram/api/methods/edit_message_text.py +++ b/aiogram/api/methods/edit_message_text.py @@ -3,7 +3,7 @@ from __future__ import annotations from typing import TYPE_CHECKING, Any, Dict, Optional, Union from ..types import UNSET, InlineKeyboardMarkup, Message -from .base import Request, TelegramMethod +from .base import Request, TelegramMethod, prepare_parse_mode if TYPE_CHECKING: # pragma: no cover from ..client.bot import Bot @@ -37,5 +37,6 @@ class EditMessageText(TelegramMethod[Union[Message, bool]]): def build_request(self, bot: Bot) -> Request: data: Dict[str, Any] = self.dict() + prepare_parse_mode(bot, data) return Request(method="editMessageText", data=data) diff --git a/aiogram/api/methods/send_animation.py b/aiogram/api/methods/send_animation.py index dcb8e91c..cbae0797 100644 --- a/aiogram/api/methods/send_animation.py +++ b/aiogram/api/methods/send_animation.py @@ -11,7 +11,7 @@ from ..types import ( ReplyKeyboardMarkup, ReplyKeyboardRemove, ) -from .base import Request, TelegramMethod, prepare_file +from .base import Request, TelegramMethod, prepare_file, prepare_parse_mode if TYPE_CHECKING: # pragma: no cover from ..client.bot import Bot @@ -66,6 +66,7 @@ class SendAnimation(TelegramMethod[Message]): def build_request(self, bot: Bot) -> Request: data: Dict[str, Any] = self.dict(exclude={"animation", "thumb"}) + prepare_parse_mode(bot, data) files: Dict[str, InputFile] = {} prepare_file(data=data, files=files, name="animation", value=self.animation) diff --git a/aiogram/api/methods/send_audio.py b/aiogram/api/methods/send_audio.py index 739fadcb..e62717c3 100644 --- a/aiogram/api/methods/send_audio.py +++ b/aiogram/api/methods/send_audio.py @@ -11,7 +11,7 @@ from ..types import ( ReplyKeyboardMarkup, ReplyKeyboardRemove, ) -from .base import Request, TelegramMethod, prepare_file +from .base import Request, TelegramMethod, prepare_file, prepare_parse_mode if TYPE_CHECKING: # pragma: no cover from ..client.bot import Bot @@ -66,6 +66,7 @@ class SendAudio(TelegramMethod[Message]): def build_request(self, bot: Bot) -> Request: data: Dict[str, Any] = self.dict(exclude={"audio", "thumb"}) + prepare_parse_mode(bot, data) files: Dict[str, InputFile] = {} prepare_file(data=data, files=files, name="audio", value=self.audio) diff --git a/aiogram/api/methods/send_document.py b/aiogram/api/methods/send_document.py index 9ee44b54..beb34376 100644 --- a/aiogram/api/methods/send_document.py +++ b/aiogram/api/methods/send_document.py @@ -11,7 +11,7 @@ from ..types import ( ReplyKeyboardMarkup, ReplyKeyboardRemove, ) -from .base import Request, TelegramMethod, prepare_file +from .base import Request, TelegramMethod, prepare_file, prepare_parse_mode if TYPE_CHECKING: # pragma: no cover from ..client.bot import Bot @@ -59,6 +59,7 @@ class SendDocument(TelegramMethod[Message]): def build_request(self, bot: Bot) -> Request: data: Dict[str, Any] = self.dict(exclude={"document", "thumb"}) + prepare_parse_mode(bot, data) files: Dict[str, InputFile] = {} prepare_file(data=data, files=files, name="document", value=self.document) diff --git a/aiogram/api/methods/send_photo.py b/aiogram/api/methods/send_photo.py index b35cc165..9f024397 100644 --- a/aiogram/api/methods/send_photo.py +++ b/aiogram/api/methods/send_photo.py @@ -11,7 +11,7 @@ from ..types import ( ReplyKeyboardMarkup, ReplyKeyboardRemove, ) -from .base import Request, TelegramMethod, prepare_file +from .base import Request, TelegramMethod, prepare_file, prepare_parse_mode if TYPE_CHECKING: # pragma: no cover from ..client.bot import Bot @@ -50,6 +50,7 @@ class SendPhoto(TelegramMethod[Message]): def build_request(self, bot: Bot) -> Request: data: Dict[str, Any] = self.dict(exclude={"photo"}) + prepare_parse_mode(bot, data) files: Dict[str, InputFile] = {} prepare_file(data=data, files=files, name="photo", value=self.photo) diff --git a/aiogram/api/methods/send_video.py b/aiogram/api/methods/send_video.py index c9c5acb2..cc688d7f 100644 --- a/aiogram/api/methods/send_video.py +++ b/aiogram/api/methods/send_video.py @@ -11,7 +11,7 @@ from ..types import ( ReplyKeyboardMarkup, ReplyKeyboardRemove, ) -from .base import Request, TelegramMethod, prepare_file +from .base import Request, TelegramMethod, prepare_file, prepare_parse_mode if TYPE_CHECKING: # pragma: no cover from ..client.bot import Bot @@ -67,6 +67,7 @@ class SendVideo(TelegramMethod[Message]): def build_request(self, bot: Bot) -> Request: data: Dict[str, Any] = self.dict(exclude={"video", "thumb"}) + prepare_parse_mode(bot, data) files: Dict[str, InputFile] = {} prepare_file(data=data, files=files, name="video", value=self.video) diff --git a/aiogram/api/methods/send_voice.py b/aiogram/api/methods/send_voice.py index 2a464439..3d731330 100644 --- a/aiogram/api/methods/send_voice.py +++ b/aiogram/api/methods/send_voice.py @@ -11,7 +11,7 @@ from ..types import ( ReplyKeyboardMarkup, ReplyKeyboardRemove, ) -from .base import Request, TelegramMethod, prepare_file +from .base import Request, TelegramMethod, prepare_file, prepare_parse_mode if TYPE_CHECKING: # pragma: no cover from ..client.bot import Bot @@ -56,6 +56,7 @@ class SendVoice(TelegramMethod[Message]): def build_request(self, bot: Bot) -> Request: data: Dict[str, Any] = self.dict(exclude={"voice"}) + prepare_parse_mode(bot, data) files: Dict[str, InputFile] = {} prepare_file(data=data, files=files, name="voice", value=self.voice)