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:
parent
62a39521d9
commit
6459ce0a07
@ -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
|
||||||
|
|
||||||
import pyrogram
|
import pyrogram
|
||||||
from pyrogram.client.ext import BaseClient
|
from pyrogram.client.ext import BaseClient
|
||||||
|
|
||||||
@ -25,7 +27,7 @@ class EditInlineCaption(BaseClient):
|
|||||||
self,
|
self,
|
||||||
inline_message_id: str,
|
inline_message_id: str,
|
||||||
caption: str,
|
caption: str,
|
||||||
parse_mode: str = "",
|
parse_mode: Union[str, None] = object,
|
||||||
reply_markup: "pyrogram.InlineKeyboardMarkup" = None
|
reply_markup: "pyrogram.InlineKeyboardMarkup" = None
|
||||||
) -> bool:
|
) -> bool:
|
||||||
"""Edit the caption of **inline** media messages.
|
"""Edit the caption of **inline** media messages.
|
||||||
|
@ -28,7 +28,7 @@ class EditMessageCaption(BaseClient):
|
|||||||
chat_id: Union[int, str],
|
chat_id: Union[int, str],
|
||||||
message_id: int,
|
message_id: int,
|
||||||
caption: str,
|
caption: str,
|
||||||
parse_mode: str = "",
|
parse_mode: Union[str, None] = object,
|
||||||
reply_markup: "pyrogram.InlineKeyboardMarkup" = None
|
reply_markup: "pyrogram.InlineKeyboardMarkup" = None
|
||||||
) -> "pyrogram.Message":
|
) -> "pyrogram.Message":
|
||||||
"""Edit the caption of media messages.
|
"""Edit the caption of media messages.
|
||||||
|
@ -34,7 +34,10 @@ class Parser:
|
|||||||
text = str(text or "").strip()
|
text = str(text or "").strip()
|
||||||
|
|
||||||
if mode == object:
|
if mode == object:
|
||||||
mode = self.client.parse_mode
|
if self.client:
|
||||||
|
mode = self.client.parse_mode
|
||||||
|
else:
|
||||||
|
mode = "combined"
|
||||||
|
|
||||||
if mode is None:
|
if mode is None:
|
||||||
return OrderedDict([
|
return OrderedDict([
|
||||||
@ -54,7 +57,7 @@ class Parser:
|
|||||||
return self.html.parse(text)
|
return self.html.parse(text)
|
||||||
|
|
||||||
raise ValueError('parse_mode must be one of {} or None. Not "{}"'.format(
|
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
|
mode
|
||||||
))
|
))
|
||||||
|
|
||||||
|
@ -176,7 +176,7 @@ class CallbackQuery(Object, Update):
|
|||||||
def edit_message_text(
|
def edit_message_text(
|
||||||
self,
|
self,
|
||||||
text: str,
|
text: str,
|
||||||
parse_mode: str = "",
|
parse_mode: Union[str, None] = object,
|
||||||
disable_web_page_preview: bool = None,
|
disable_web_page_preview: bool = None,
|
||||||
reply_markup: "pyrogram.InlineKeyboardMarkup" = None
|
reply_markup: "pyrogram.InlineKeyboardMarkup" = None
|
||||||
) -> Union["pyrogram.Message", bool]:
|
) -> Union["pyrogram.Message", bool]:
|
||||||
@ -229,7 +229,7 @@ class CallbackQuery(Object, Update):
|
|||||||
def edit_message_caption(
|
def edit_message_caption(
|
||||||
self,
|
self,
|
||||||
caption: str,
|
caption: str,
|
||||||
parse_mode: str = "",
|
parse_mode: Union[str, None] = object,
|
||||||
reply_markup: "pyrogram.InlineKeyboardMarkup" = None
|
reply_markup: "pyrogram.InlineKeyboardMarkup" = None
|
||||||
) -> Union["pyrogram.Message", bool]:
|
) -> Union["pyrogram.Message", bool]:
|
||||||
"""Edit the caption of media messages attached to callback queries.
|
"""Edit the caption of media messages attached to callback queries.
|
||||||
|
@ -654,7 +654,7 @@ class Message(Object, Update):
|
|||||||
self,
|
self,
|
||||||
text: str,
|
text: str,
|
||||||
quote: bool = None,
|
quote: bool = None,
|
||||||
parse_mode: str = "",
|
parse_mode: Union[str, None] = object,
|
||||||
disable_web_page_preview: bool = None,
|
disable_web_page_preview: bool = None,
|
||||||
disable_notification: bool = None,
|
disable_notification: bool = None,
|
||||||
reply_to_message_id: int = None,
|
reply_to_message_id: int = None,
|
||||||
@ -736,7 +736,7 @@ class Message(Object, Update):
|
|||||||
animation: str,
|
animation: str,
|
||||||
quote: bool = None,
|
quote: bool = None,
|
||||||
caption: str = "",
|
caption: str = "",
|
||||||
parse_mode: str = "",
|
parse_mode: Union[str, None] = object,
|
||||||
duration: int = 0,
|
duration: int = 0,
|
||||||
width: int = 0,
|
width: int = 0,
|
||||||
height: int = 0,
|
height: int = 0,
|
||||||
@ -873,7 +873,7 @@ class Message(Object, Update):
|
|||||||
audio: str,
|
audio: str,
|
||||||
quote: bool = None,
|
quote: bool = None,
|
||||||
caption: str = "",
|
caption: str = "",
|
||||||
parse_mode: str = "",
|
parse_mode: Union[str, None] = object,
|
||||||
duration: int = 0,
|
duration: int = 0,
|
||||||
performer: str = None,
|
performer: str = None,
|
||||||
title: str = None,
|
title: str = None,
|
||||||
@ -1010,7 +1010,7 @@ class Message(Object, Update):
|
|||||||
file_id: str,
|
file_id: str,
|
||||||
quote: bool = None,
|
quote: bool = None,
|
||||||
caption: str = "",
|
caption: str = "",
|
||||||
parse_mode: str = "",
|
parse_mode: Union[str, None] = object,
|
||||||
disable_notification: bool = None,
|
disable_notification: bool = None,
|
||||||
reply_to_message_id: int = None,
|
reply_to_message_id: int = None,
|
||||||
reply_markup: Union[
|
reply_markup: Union[
|
||||||
@ -1218,7 +1218,7 @@ class Message(Object, Update):
|
|||||||
quote: bool = None,
|
quote: bool = None,
|
||||||
thumb: str = None,
|
thumb: str = None,
|
||||||
caption: str = "",
|
caption: str = "",
|
||||||
parse_mode: str = "",
|
parse_mode: Union[str, None] = object,
|
||||||
disable_notification: bool = None,
|
disable_notification: bool = None,
|
||||||
reply_to_message_id: int = None,
|
reply_to_message_id: int = None,
|
||||||
reply_markup: Union[
|
reply_markup: Union[
|
||||||
@ -1613,7 +1613,7 @@ class Message(Object, Update):
|
|||||||
photo: str,
|
photo: str,
|
||||||
quote: bool = None,
|
quote: bool = None,
|
||||||
caption: str = "",
|
caption: str = "",
|
||||||
parse_mode: str = "",
|
parse_mode: Union[str, None] = object,
|
||||||
ttl_seconds: int = None,
|
ttl_seconds: int = None,
|
||||||
disable_notification: bool = None,
|
disable_notification: bool = None,
|
||||||
reply_to_message_id: int = None,
|
reply_to_message_id: int = None,
|
||||||
@ -2007,7 +2007,7 @@ class Message(Object, Update):
|
|||||||
video: str,
|
video: str,
|
||||||
quote: bool = None,
|
quote: bool = None,
|
||||||
caption: str = "",
|
caption: str = "",
|
||||||
parse_mode: str = "",
|
parse_mode: Union[str, None] = object,
|
||||||
duration: int = 0,
|
duration: int = 0,
|
||||||
width: int = 0,
|
width: int = 0,
|
||||||
height: int = 0,
|
height: int = 0,
|
||||||
@ -2267,7 +2267,7 @@ class Message(Object, Update):
|
|||||||
voice: str,
|
voice: str,
|
||||||
quote: bool = None,
|
quote: bool = None,
|
||||||
caption: str = "",
|
caption: str = "",
|
||||||
parse_mode: str = "",
|
parse_mode: Union[str, None] = object,
|
||||||
duration: int = 0,
|
duration: int = 0,
|
||||||
disable_notification: bool = None,
|
disable_notification: bool = None,
|
||||||
reply_to_message_id: int = None,
|
reply_to_message_id: int = None,
|
||||||
@ -2384,7 +2384,7 @@ class Message(Object, Update):
|
|||||||
def edit_text(
|
def edit_text(
|
||||||
self,
|
self,
|
||||||
text: str,
|
text: str,
|
||||||
parse_mode: str = "",
|
parse_mode: Union[str, None] = object,
|
||||||
disable_web_page_preview: bool = None,
|
disable_web_page_preview: bool = None,
|
||||||
reply_markup: "pyrogram.InlineKeyboardMarkup" = None
|
reply_markup: "pyrogram.InlineKeyboardMarkup" = None
|
||||||
) -> "Message":
|
) -> "Message":
|
||||||
@ -2442,7 +2442,7 @@ class Message(Object, Update):
|
|||||||
def edit_caption(
|
def edit_caption(
|
||||||
self,
|
self,
|
||||||
caption: str,
|
caption: str,
|
||||||
parse_mode: str = "",
|
parse_mode: Union[str, None] = object,
|
||||||
reply_markup: "pyrogram.InlineKeyboardMarkup" = None
|
reply_markup: "pyrogram.InlineKeyboardMarkup" = None
|
||||||
) -> "Message":
|
) -> "Message":
|
||||||
"""Bound method *edit_caption* of :obj:`Message`.
|
"""Bound method *edit_caption* of :obj:`Message`.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user