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

Skip to content
This repository was archived by the owner on Dec 23, 2024. It is now read-only.

Fixed entity type into unparse method #1266

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mushishiva
Copy link

MessageEntity object has no attribute type

import asyncio
from pyrogram.parser.parser import Parser

parser = Parser(None)

samples = ["__Italic text__", "**Bold text**"]
# samples = ["<i>Italic text</i>", "<b>Bold text</b>"]

async def main():
    for sample in samples:
        message, entities = (await parser.parse(text=sample)).values()

        print(message, entities)

        res = parser.unparse(text=message, entities=entities, is_html=False)  # AttributeError: 'MessageEntityItalic' object has no attribute 'type'

        print(res)


asyncio.run(main())

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging this pull request may close these issues.

1 participant