Fix unsupported parse_mode in some methods

This commit is contained in:
evgfilim1 2020-10-31 17:23:08 +05:00
parent 85265a34cd
commit 8c43dccf79
No known key found for this signature in database
GPG key ID: 16AEE4D0BB188AEC
7 changed files with 14 additions and 7 deletions

View file

@ -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)

View file

@ -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)

View file

@ -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)

View file

@ -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)

View file

@ -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)

View file

@ -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)

View file

@ -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)