2
0
mirror of https://github.com/pyrogram/pyrogram synced 2025-08-29 13:27:47 +00:00

Fix lots of bound methods breaking due to latest changes on parse_mode

Addresses #287
This commit is contained in:
Dan 2019-07-21 01:03:19 +02:00
parent 62a39521d9
commit 6459ce0a07
5 changed files with 21 additions and 16 deletions

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
import pyrogram
from pyrogram.client.ext import BaseClient
@ -25,7 +27,7 @@ class EditInlineCaption(BaseClient):
self,
inline_message_id: str,
caption: str,
parse_mode: str = "",
parse_mode: Union[str, None] = object,
reply_markup: "pyrogram.InlineKeyboardMarkup" = None
) -> bool:
"""Edit the caption of **inline** media messages.

View File

@ -28,7 +28,7 @@ class EditMessageCaption(BaseClient):
chat_id: Union[int, str],
message_id: int,
caption: str,
parse_mode: str = "",
parse_mode: Union[str, None] = object,
reply_markup: "pyrogram.InlineKeyboardMarkup" = None
) -> "pyrogram.Message":
"""Edit the caption of media messages.

View File

@ -34,7 +34,10 @@ class Parser:
text = str(text or "").strip()
if mode == object:
mode = self.client.parse_mode
if self.client:
mode = self.client.parse_mode
else:
mode = "combined"
if mode is None:
return OrderedDict([
@ -54,7 +57,7 @@ class Parser:
return self.html.parse(text)
raise ValueError('parse_mode must be one of {} or None. Not "{}"'.format(
", ".join('"{}"'.format(m) for m in self.client.PARSE_MODES[:-1]),
", ".join('"{}"'.format(m) for m in pyrogram.Client.PARSE_MODES[:-1]),
mode
))

View File

@ -176,7 +176,7 @@ class CallbackQuery(Object, Update):
def edit_message_text(
self,
text: str,
parse_mode: str = "",
parse_mode: Union[str, None] = object,
disable_web_page_preview: bool = None,
reply_markup: "pyrogram.InlineKeyboardMarkup" = None
) -> Union["pyrogram.Message", bool]:
@ -229,7 +229,7 @@ class CallbackQuery(Object, Update):
def edit_message_caption(
self,
caption: str,
parse_mode: str = "",
parse_mode: Union[str, None] = object,
reply_markup: "pyrogram.InlineKeyboardMarkup" = None
) -> Union["pyrogram.Message", bool]:
"""Edit the caption of media messages attached to callback queries.

View File

@ -654,7 +654,7 @@ class Message(Object, Update):
self,
text: str,
quote: bool = None,
parse_mode: str = "",
parse_mode: Union[str, None] = object,
disable_web_page_preview: bool = None,
disable_notification: bool = None,
reply_to_message_id: int = None,
@ -736,7 +736,7 @@ class Message(Object, Update):
animation: str,
quote: bool = None,
caption: str = "",
parse_mode: str = "",
parse_mode: Union[str, None] = object,
duration: int = 0,
width: int = 0,
height: int = 0,
@ -873,7 +873,7 @@ class Message(Object, Update):
audio: str,
quote: bool = None,
caption: str = "",
parse_mode: str = "",
parse_mode: Union[str, None] = object,
duration: int = 0,
performer: str = None,
title: str = None,
@ -1010,7 +1010,7 @@ class Message(Object, Update):
file_id: str,
quote: bool = None,
caption: str = "",
parse_mode: str = "",
parse_mode: Union[str, None] = object,
disable_notification: bool = None,
reply_to_message_id: int = None,
reply_markup: Union[
@ -1218,7 +1218,7 @@ class Message(Object, Update):
quote: bool = None,
thumb: str = None,
caption: str = "",
parse_mode: str = "",
parse_mode: Union[str, None] = object,
disable_notification: bool = None,
reply_to_message_id: int = None,
reply_markup: Union[
@ -1613,7 +1613,7 @@ class Message(Object, Update):
photo: str,
quote: bool = None,
caption: str = "",
parse_mode: str = "",
parse_mode: Union[str, None] = object,
ttl_seconds: int = None,
disable_notification: bool = None,
reply_to_message_id: int = None,
@ -2007,7 +2007,7 @@ class Message(Object, Update):
video: str,
quote: bool = None,
caption: str = "",
parse_mode: str = "",
parse_mode: Union[str, None] = object,
duration: int = 0,
width: int = 0,
height: int = 0,
@ -2267,7 +2267,7 @@ class Message(Object, Update):
voice: str,
quote: bool = None,
caption: str = "",
parse_mode: str = "",
parse_mode: Union[str, None] = object,
duration: int = 0,
disable_notification: bool = None,
reply_to_message_id: int = None,
@ -2384,7 +2384,7 @@ class Message(Object, Update):
def edit_text(
self,
text: str,
parse_mode: str = "",
parse_mode: Union[str, None] = object,
disable_web_page_preview: bool = None,
reply_markup: "pyrogram.InlineKeyboardMarkup" = None
) -> "Message":
@ -2442,7 +2442,7 @@ class Message(Object, Update):
def edit_caption(
self,
caption: str,
parse_mode: str = "",
parse_mode: Union[str, None] = object,
reply_markup: "pyrogram.InlineKeyboardMarkup" = None
) -> "Message":
"""Bound method *edit_caption* of :obj:`Message`.