Fix some methods not being defined using async

This commit is contained in:
Dan 2019-07-31 13:33:04 +02:00
parent 0f9029202e
commit 8700e3a0f3
2 changed files with 34 additions and 34 deletions

View File

@ -146,29 +146,29 @@ class BaseClient:
async def answer_inline_query(self, *args, **kwargs): async def answer_inline_query(self, *args, **kwargs):
pass 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): def guess_mime_type(self, *args, **kwargs):
pass pass
def guess_extension(self, *args, **kwargs): def guess_extension(self, *args, **kwargs):
pass 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

View File

@ -129,7 +129,7 @@ class CallbackQuery(Object, Update):
client=client 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`. """Bound method *answer* of :obj:`CallbackQuery`.
Use this method as a shortcut for: 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. 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. 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, callback_query_id=self.id,
text=text, text=text,
show_alert=show_alert, show_alert=show_alert,
@ -173,7 +173,7 @@ class CallbackQuery(Object, Update):
cache_time=cache_time cache_time=cache_time
) )
def edit_message_text( async def edit_message_text(
self, self,
text: str, text: str,
parse_mode: Union[str, None] = object, parse_mode: Union[str, None] = object,
@ -209,7 +209,7 @@ class CallbackQuery(Object, Update):
RPCError: In case of a Telegram RPC error. RPCError: In case of a Telegram RPC error.
""" """
if self.inline_message_id is None: 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, chat_id=self.message.chat.id,
message_id=self.message.message_id, message_id=self.message.message_id,
text=text, text=text,
@ -218,7 +218,7 @@ class CallbackQuery(Object, Update):
reply_markup=reply_markup reply_markup=reply_markup
) )
else: else:
return self._client.edit_inline_text( return await self._client.edit_inline_text(
inline_message_id=self.inline_message_id, inline_message_id=self.inline_message_id,
text=text, text=text,
parse_mode=parse_mode, parse_mode=parse_mode,
@ -226,7 +226,7 @@ class CallbackQuery(Object, Update):
reply_markup=reply_markup reply_markup=reply_markup
) )
def edit_message_caption( async def edit_message_caption(
self, self,
caption: str, caption: str,
parse_mode: Union[str, None] = object, parse_mode: Union[str, None] = object,
@ -257,9 +257,9 @@ class CallbackQuery(Object, Update):
Raises: Raises:
RPCError: In case of a Telegram RPC error. 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, self,
media: "pyrogram.InputMedia", media: "pyrogram.InputMedia",
reply_markup: "pyrogram.InlineKeyboardMarkup" = None reply_markup: "pyrogram.InlineKeyboardMarkup" = None
@ -283,20 +283,20 @@ class CallbackQuery(Object, Update):
RPCError: In case of a Telegram RPC error. RPCError: In case of a Telegram RPC error.
""" """
if self.inline_message_id is None: 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, chat_id=self.message.chat.id,
message_id=self.message.message_id, message_id=self.message.message_id,
media=media, media=media,
reply_markup=reply_markup reply_markup=reply_markup
) )
else: else:
return self._client.edit_inline_media( return await self._client.edit_inline_media(
inline_message_id=self.inline_message_id, inline_message_id=self.inline_message_id,
media=media, media=media,
reply_markup=reply_markup reply_markup=reply_markup
) )
def edit_message_reply_markup( async def edit_message_reply_markup(
self, self,
reply_markup: "pyrogram.InlineKeyboardMarkup" = None reply_markup: "pyrogram.InlineKeyboardMarkup" = None
) -> Union["pyrogram.Message", bool]: ) -> Union["pyrogram.Message", bool]:
@ -316,13 +316,13 @@ class CallbackQuery(Object, Update):
RPCError: In case of a Telegram RPC error. RPCError: In case of a Telegram RPC error.
""" """
if self.inline_message_id is None: 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, chat_id=self.message.chat.id,
message_id=self.message.message_id, message_id=self.message.message_id,
reply_markup=reply_markup reply_markup=reply_markup
) )
else: else:
return self._client.edit_inline_reply_markup( return await self._client.edit_inline_reply_markup(
inline_message_id=self.inline_message_id, inline_message_id=self.inline_message_id,
reply_markup=reply_markup reply_markup=reply_markup
) )