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