mirror of
https://github.com/pyrogram/pyrogram
synced 2025-08-28 21:07:59 +00:00
Fix some methods not working correctly with the new Text Parser
This commit is contained in:
parent
3f2f40af02
commit
be3947e20b
@ -55,8 +55,8 @@ class EditInlineMedia(BaseClient):
|
||||
Raises:
|
||||
RPCError: In case of a Telegram RPC error.
|
||||
"""
|
||||
style = self.html if media.parse_mode.lower() == "html" else self.markdown
|
||||
caption = media.caption
|
||||
parse_mode = media.parse_mode
|
||||
|
||||
if isinstance(media, InputMediaPhoto):
|
||||
if media.media.startswith("http"):
|
||||
@ -99,6 +99,6 @@ class EditInlineMedia(BaseClient):
|
||||
id=utils.unpack_inline_message_id(inline_message_id),
|
||||
media=media,
|
||||
reply_markup=reply_markup.write() if reply_markup else None,
|
||||
**style.parse(caption)
|
||||
**self.parser.parse(caption, parse_mode)
|
||||
)
|
||||
)
|
||||
|
@ -63,8 +63,8 @@ class EditMessageMedia(BaseClient):
|
||||
Raises:
|
||||
RPCError: In case of a Telegram RPC error.
|
||||
"""
|
||||
style = self.html if media.parse_mode.lower() == "html" else self.markdown
|
||||
caption = media.caption
|
||||
parse_mode = media.parse_mode
|
||||
|
||||
if isinstance(media, InputMediaPhoto):
|
||||
if os.path.exists(media.media):
|
||||
@ -239,7 +239,7 @@ class EditMessageMedia(BaseClient):
|
||||
id=message_id,
|
||||
media=media,
|
||||
reply_markup=reply_markup.write() if reply_markup else None,
|
||||
**style.parse(caption)
|
||||
**self.parser.parse(caption, parse_mode)
|
||||
)
|
||||
)
|
||||
|
||||
|
@ -66,8 +66,6 @@ class SendMediaGroup(BaseClient):
|
||||
multi_media = []
|
||||
|
||||
for i in media:
|
||||
style = self.html if i.parse_mode.lower() == "html" else self.markdown
|
||||
|
||||
if isinstance(i, pyrogram.InputMediaPhoto):
|
||||
if os.path.exists(i.media):
|
||||
while True:
|
||||
@ -138,7 +136,7 @@ class SendMediaGroup(BaseClient):
|
||||
types.InputSingleMedia(
|
||||
media=media,
|
||||
random_id=self.rnd_id(),
|
||||
**style.parse(i.caption)
|
||||
**self.parser.parse(i.caption, i.parse_mode)
|
||||
)
|
||||
)
|
||||
|
||||
|
@ -16,6 +16,8 @@
|
||||
# You should have received a copy of the GNU Lesser General Public License
|
||||
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
from typing import Union
|
||||
|
||||
from . import InputMedia
|
||||
|
||||
|
||||
@ -61,7 +63,7 @@ class InputMediaAnimation(InputMedia):
|
||||
media: str,
|
||||
thumb: str = None,
|
||||
caption: str = "",
|
||||
parse_mode: str = "",
|
||||
parse_mode: Union[str, None] = "",
|
||||
width: int = 0,
|
||||
height: int = 0,
|
||||
duration: int = 0
|
||||
|
@ -16,6 +16,8 @@
|
||||
# You should have received a copy of the GNU Lesser General Public License
|
||||
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
from typing import Union
|
||||
|
||||
from . import InputMedia
|
||||
|
||||
|
||||
@ -63,7 +65,7 @@ class InputMediaAudio(InputMedia):
|
||||
media: str,
|
||||
thumb: str = None,
|
||||
caption: str = "",
|
||||
parse_mode: str = "",
|
||||
parse_mode: Union[str, None] = "",
|
||||
duration: int = 0,
|
||||
performer: int = "",
|
||||
title: str = ""
|
||||
|
@ -16,6 +16,8 @@
|
||||
# You should have received a copy of the GNU Lesser General Public License
|
||||
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
from typing import Union
|
||||
|
||||
from . import InputMedia
|
||||
|
||||
|
||||
@ -52,7 +54,7 @@ class InputMediaDocument(InputMedia):
|
||||
media: str,
|
||||
thumb: str = None,
|
||||
caption: str = "",
|
||||
parse_mode: str = ""
|
||||
parse_mode: Union[str, None] = ""
|
||||
):
|
||||
super().__init__(media, caption, parse_mode)
|
||||
|
||||
|
@ -16,6 +16,8 @@
|
||||
# You should have received a copy of the GNU Lesser General Public License
|
||||
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
from typing import Union
|
||||
|
||||
from . import InputMedia
|
||||
|
||||
|
||||
@ -47,6 +49,6 @@ class InputMediaPhoto(InputMedia):
|
||||
self,
|
||||
media: str,
|
||||
caption: str = "",
|
||||
parse_mode: str = ""
|
||||
parse_mode: Union[str, None] = ""
|
||||
):
|
||||
super().__init__(media, caption, parse_mode)
|
||||
|
@ -16,6 +16,8 @@
|
||||
# You should have received a copy of the GNU Lesser General Public License
|
||||
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
from typing import Union
|
||||
|
||||
from . import InputMedia
|
||||
|
||||
|
||||
@ -66,7 +68,7 @@ class InputMediaVideo(InputMedia):
|
||||
media: str,
|
||||
thumb: str = None,
|
||||
caption: str = "",
|
||||
parse_mode: str = "",
|
||||
parse_mode: Union[str, None] = "",
|
||||
width: int = 0,
|
||||
height: int = 0,
|
||||
duration: int = 0,
|
||||
|
Loading…
x
Reference in New Issue
Block a user