Add support for message entities
pietroalbini opened this issue · 0 comments
pietroalbini commented
The new update of the Bots API includes in every Message
a list of the rich-text entities. I don't want to just pass the raw data botogram receives to the developer, but parse it to provide a better resource.
- Provide the text of the entity other than just the limit and the offset
- Add non-rich text as a
PlainEntity
to the entities list, so you can rebuild the whole message text from it - Add ability to filter in or out some entities, in order to get just the ones you want
>>> print(message.text)
"/mail - Send a mail to suport@example.com"
>>> entities = message.rich_text
>>> print(entities)
[<Entity command: "/mail">, <Entity plain: " - Send a mail to ">, <Entity email: "support@example.com">]
>>> special = message.rich_text.exclude("plain")
>>> print(special)
[<Entity command: "/mail">, <Entity email: "support@example.com">]