Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upGitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
Mentions failed in InputTextMessageContent #428
Comments
|
This temporary solved this issue:
|
|
@sviat9440 Hi, that of course solves the problem, but the main issue is that now you need to pass a client reference to |
|
I understand of course. But I have no other choice yet. |
|
Just a small update on this: the provided example does not work as-is with pyrogram 1.0.x. Since this does not appear to be fixed yet I'll include here an updated patch that works with the latest stable release from typing import Union
from pyrogram import Client
from pyrogram.parser import Parser
from pyrogram.raw.types import InputBotInlineMessageText
class InputTextMessageContent(InputMessageContent):
"""
see https://github.com/pyrogram/pyrogram/issues/428
"""
def __init__(
self,
message_text: str,
parse_mode: Union[str, None] = object,
disable_web_page_preview: bool = None,
client: Client = None,
):
super().__init__()
self.message_text = message_text
self.parse_mode = parse_mode
self.disable_web_page_preview = disable_web_page_preview
self.client = client
async def write(self, reply_markup):
parser = Parser(self.client)
return InputBotInlineMessageText(
no_webpage=self.disable_web_page_preview or None,
reply_markup=reply_markup.write() if reply_markup else None,
**(await parser.parse(self.message_text, self.parse_mode)
)
)I've added the imports as well so that one does not need to dig into pyrogram's source code to figure out where to import everything like I had to do |

Formed in 2009, the Archive Team (not to be confused with the archive.org Archive-It Team) is a rogue archivist collective dedicated to saving copies of rapidly dying or deleted websites for the sake of history and digital heritage. The group is 100% composed of volunteers and interested parties, and has expanded into a large amount of related projects for saving online and digital history.

Checklist
pip3 install -U https://github.com/pyrogram/pyrogram/archive/develop.zipand reproduced the issue using the latest development version.Description
When i try to answer for inline_query with text mentions, i get this error:
Steps to Reproduce
Traceback