Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Энтити с упоминанием ломаются #265

@CrowTheBest

Description

@CrowTheBest

Checklist

  • I am sure the error is coming from Kurigram's code and not elsewhere
  • I have searched in the issue tracker for similar bug reports, including closed ones
  • I ran pip3 install -U https://github.com/KurimuzonAkuma/pyrogram/archive/dev.zip and reproduced the issue using the latest development version

Description

Невозможно добавить свои энтити в сообщение, если в них есть упоминание кого-нибудь

Steps to reproduce

1, Создайте любой текст, в котором будет упоминание пользователя
2. Распарсите его через client.parser.parse()
3. Прокиньте в метод отправки сообщения

AttributeError: 'InputMessageEntityMentionName' object has no attribute '_client'

Code example

tg_user = '[Пользователь](tg://user?id=12345)'
text, entities = await client.parser.parse(tg_user)
await client.send_message(12345, text, parse_mode=ParseMode.DISABLED, entities=entities)

Logs

File "D:\test\PycharmProjects\testbot\.venv\Lib\site-packages\pyrogram\methods\messages\send_message.py", line 253, in send_message
    message, entities = (await utils.parse_text_entities(self, text, parse_mode, entities)).values()
                               │     │                   │     │     │           └ [pyrogram.raw.types.InputMessageEntityMentionName(offset=10, length=8, user_id=pyrogram.raw.types.InputPeerUser(user_id=94683...
                               │     │                   │     │     └ pyrogram.enums.ParseMode.DISABLED
                               │     │                   │     └ 'text...
                               │     │                   └ <pyrogram.client.Client object at 0x000001C72E17E090>
                               │     └ <function parse_text_entities at 0x000001C72BFF23E0>
                               └ <module 'pyrogram.utils' from '"D:\test\PycharmProjects\testbot\.venv\Lib\site-packages\pyrogram\utils.py'>
  File "D:\test\PycharmProjects\testbot\.venv\Lib\site-packages\pyrogram\utils.py", line 553, in parse_text_entities
    entity._client = client
    │                └ <pyrogram.client.Client object at 0x000001C72E17E090>
    └ pyrogram.raw.types.InputMessageEntityMentionName(offset=10, length=8, user_id=pyrogram.raw.types.InputPeerUser(user_id=946837...

AttributeError: 'InputMessageEntityMentionName' object has no attribute '_client'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions