2
0
mirror of https://github.com/pyrogram/pyrogram synced 2025-08-30 05:48:14 +00:00

Merge develop -> asyncio

This commit is contained in:
Dan 2019-07-02 00:05:51 +02:00
commit ac4714c0dd
9 changed files with 21 additions and 13 deletions

View File

@ -24,7 +24,7 @@ if sys.version_info[:3] in [(3, 5, 0), (3, 5, 1), (3, 5, 2)]:
# Monkey patch the standard "typing" module because Python versions from 3.5.0 to 3.5.2 have a broken one.
sys.modules["typing"] = typing
__version__ = "0.15.0-asyncio"
__version__ = "0.15.1-asyncio"
__license__ = "GNU Lesser General Public License v3 or later (LGPLv3+)"
__copyright__ = "Copyright (C) 2017-2019 Dan <https://github.com/delivrance>"

View File

@ -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)
**await self.parser.parse(caption, parse_mode)
)
)

View File

@ -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,
**await style.parse(caption)
**await self.parser.parse(caption, parse_mode)
)
)

View File

@ -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(),
**await style.parse(i.caption)
**await self.parser.parse(i.caption, i.parse_mode)
)
)

View File

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

View File

@ -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 = ""

View File

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

View File

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

View File

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