diff --git a/pyrogram/client/methods/bots/answer_inline_query.py b/pyrogram/client/methods/bots/answer_inline_query.py index 65f2ff3a..88a661d0 100644 --- a/pyrogram/client/methods/bots/answer_inline_query.py +++ b/pyrogram/client/methods/bots/answer_inline_query.py @@ -75,10 +75,15 @@ class AnswerInlineQuery(BaseClient): Returns: On success, True is returned. """ + written_results = [] # Py 3.5 doesn't support await inside comprehensions + + for r in results: + written_results.append(await r.write()) + return await self.send( functions.messages.SetInlineBotResults( query_id=int(inline_query_id), - results=[r.write() for r in results], + results=written_results, cache_time=cache_time, gallery=None, private=is_personal or None, diff --git a/pyrogram/client/types/inline_mode/inline_query_result.py b/pyrogram/client/types/inline_mode/inline_query_result.py index 3e7fcb02..6fd1975d 100644 --- a/pyrogram/client/types/inline_mode/inline_query_result.py +++ b/pyrogram/client/types/inline_mode/inline_query_result.py @@ -55,5 +55,5 @@ class InlineQueryResult(PyrogramType): self.type = type self.id = id - def write(self): + async def write(self): pass diff --git a/pyrogram/client/types/inline_mode/inline_query_result_article.py b/pyrogram/client/types/inline_mode/inline_query_result_article.py index 8d0089c3..3f0c2997 100644 --- a/pyrogram/client/types/inline_mode/inline_query_result_article.py +++ b/pyrogram/client/types/inline_mode/inline_query_result_article.py @@ -84,11 +84,11 @@ class InlineQueryResultArticle(InlineQueryResult): self.thumb_width = thumb_width self.thumb_height = thumb_height - def write(self): + async def write(self): return types.InputBotInlineResult( id=str(self.id), type=self.type, - send_message=self.input_message_content.write(self.reply_markup), + send_message=await self.input_message_content.write(self.reply_markup), title=self.title, description=self.description, url=self.url, diff --git a/pyrogram/client/types/input_message_content/input_text_message_content.py b/pyrogram/client/types/input_message_content/input_text_message_content.py index 0e6ffa8b..dda1f3f3 100644 --- a/pyrogram/client/types/input_message_content/input_text_message_content.py +++ b/pyrogram/client/types/input_message_content/input_text_message_content.py @@ -46,9 +46,9 @@ class InputTextMessageContent(InputMessageContent): self.parse_mode = parse_mode self.disable_web_page_preview = disable_web_page_preview - def write(self, reply_markup): + async def write(self, reply_markup): return types.InputBotInlineMessageText( no_webpage=self.disable_web_page_preview or None, reply_markup=reply_markup.write() if reply_markup else None, - **(HTML() if self.parse_mode.lower() == "html" else Markdown()).parse(self.message_text) + **await(HTML() if self.parse_mode.lower() == "html" else Markdown()).parse(self.message_text) )