From 8700e3a0f3a2e4e12c9c5dfaa5382e765e1149ba Mon Sep 17 00:00:00 2001 From: Dan <14043624+delivrance@users.noreply.github.com> Date: Wed, 31 Jul 2019 13:33:04 +0200 Subject: [PATCH] Fix some methods not being defined using async --- pyrogram/client/ext/base_client.py | 42 +++++++++---------- .../bots_and_keyboards/callback_query.py | 26 ++++++------ 2 files changed, 34 insertions(+), 34 deletions(-) diff --git a/pyrogram/client/ext/base_client.py b/pyrogram/client/ext/base_client.py index 640e7e65..230c681f 100644 --- a/pyrogram/client/ext/base_client.py +++ b/pyrogram/client/ext/base_client.py @@ -146,29 +146,29 @@ class BaseClient: async def answer_inline_query(self, *args, **kwargs): pass + async def get_profile_photos(self, *args, **kwargs): + pass + + async def edit_message_text(self, *args, **kwargs): + pass + + async def edit_inline_text(self, *args, **kwargs): + pass + + async def edit_message_media(self, *args, **kwargs): + pass + + async def edit_inline_media(self, *args, **kwargs): + pass + + async def edit_message_reply_markup(self, *args, **kwargs): + pass + + async def edit_inline_reply_markup(self, *args, **kwargs): + pass + def guess_mime_type(self, *args, **kwargs): pass def guess_extension(self, *args, **kwargs): pass - - def get_profile_photos(self, *args, **kwargs): - pass - - def edit_message_text(self, *args, **kwargs): - pass - - def edit_inline_text(self, *args, **kwargs): - pass - - def edit_message_media(self, *args, **kwargs): - pass - - def edit_inline_media(self, *args, **kwargs): - pass - - def edit_message_reply_markup(self, *args, **kwargs): - pass - - def edit_inline_reply_markup(self, *args, **kwargs): - pass diff --git a/pyrogram/client/types/bots_and_keyboards/callback_query.py b/pyrogram/client/types/bots_and_keyboards/callback_query.py index 0264a67c..27cebd7e 100644 --- a/pyrogram/client/types/bots_and_keyboards/callback_query.py +++ b/pyrogram/client/types/bots_and_keyboards/callback_query.py @@ -129,7 +129,7 @@ class CallbackQuery(Object, Update): client=client ) - def answer(self, text: str = None, show_alert: bool = None, url: str = None, cache_time: int = 0): + async def answer(self, text: str = None, show_alert: bool = None, url: str = None, cache_time: int = 0): """Bound method *answer* of :obj:`CallbackQuery`. Use this method as a shortcut for: @@ -165,7 +165,7 @@ class CallbackQuery(Object, Update): The maximum amount of time in seconds that the result of the callback query may be cached client-side. Telegram apps will support caching starting in version 3.14. Defaults to 0. """ - return self._client.answer_callback_query( + return await self._client.answer_callback_query( callback_query_id=self.id, text=text, show_alert=show_alert, @@ -173,7 +173,7 @@ class CallbackQuery(Object, Update): cache_time=cache_time ) - def edit_message_text( + async def edit_message_text( self, text: str, parse_mode: Union[str, None] = object, @@ -209,7 +209,7 @@ class CallbackQuery(Object, Update): RPCError: In case of a Telegram RPC error. """ if self.inline_message_id is None: - return self._client.edit_message_text( + return await self._client.edit_message_text( chat_id=self.message.chat.id, message_id=self.message.message_id, text=text, @@ -218,7 +218,7 @@ class CallbackQuery(Object, Update): reply_markup=reply_markup ) else: - return self._client.edit_inline_text( + return await self._client.edit_inline_text( inline_message_id=self.inline_message_id, text=text, parse_mode=parse_mode, @@ -226,7 +226,7 @@ class CallbackQuery(Object, Update): reply_markup=reply_markup ) - def edit_message_caption( + async def edit_message_caption( self, caption: str, parse_mode: Union[str, None] = object, @@ -257,9 +257,9 @@ class CallbackQuery(Object, Update): Raises: RPCError: In case of a Telegram RPC error. """ - return self.edit_message_text(caption, parse_mode, reply_markup) + return await self.edit_message_text(caption, parse_mode, reply_markup) - def edit_message_media( + async def edit_message_media( self, media: "pyrogram.InputMedia", reply_markup: "pyrogram.InlineKeyboardMarkup" = None @@ -283,20 +283,20 @@ class CallbackQuery(Object, Update): RPCError: In case of a Telegram RPC error. """ if self.inline_message_id is None: - return self._client.edit_message_media( + return await self._client.edit_message_media( chat_id=self.message.chat.id, message_id=self.message.message_id, media=media, reply_markup=reply_markup ) else: - return self._client.edit_inline_media( + return await self._client.edit_inline_media( inline_message_id=self.inline_message_id, media=media, reply_markup=reply_markup ) - def edit_message_reply_markup( + async def edit_message_reply_markup( self, reply_markup: "pyrogram.InlineKeyboardMarkup" = None ) -> Union["pyrogram.Message", bool]: @@ -316,13 +316,13 @@ class CallbackQuery(Object, Update): RPCError: In case of a Telegram RPC error. """ if self.inline_message_id is None: - return self._client.edit_message_reply_markup( + return await self._client.edit_message_reply_markup( chat_id=self.message.chat.id, message_id=self.message.message_id, reply_markup=reply_markup ) else: - return self._client.edit_inline_reply_markup( + return await self._client.edit_inline_reply_markup( inline_message_id=self.inline_message_id, reply_markup=reply_markup )