Sitelet https://web.archive.org/web/20201210054301/https://github.com/pyrogram/pyrogram/issues/412
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ability for MessageEntity objects to know how to get its own text out #412

Open
delivrance opened this issue May 22, 2020 · 4 comments
Open

Comments

@delivrance
Copy link
Member

@delivrance delivrance commented May 22, 2020

Checklist

  • I believe the idea is awesome and would benefit the library.
  • I have searched in the issue tracker for similar requests, including closed ones.
@JosXa
Copy link
Contributor

@JosXa JosXa commented Sep 29, 2020

@delivrance
Copy link
Member Author

@delivrance delivrance commented Oct 1, 2020

(note that Pyrogram already handles utf-16-le enc/decoding, so it's just a matter of doing return text[offset:offset+length]).

My original idea was to have something like msg_entity.text, without the need of a special type. The issue with my idea is that we need to add a reference to the message text inside MessageEntity.

@JosXa
Copy link
Contributor

@JosXa JosXa commented Oct 2, 2020

If you're unhappy with that (which I understand), maybe just add a method that takes the message text. I'd be fine with that

@JosXa
Copy link
Contributor

@JosXa JosXa commented Oct 2, 2020 •

While you're at it, do you think this could benefit from some polymorphism?

user (:obj:`~pyrogram.types.User`, *optional*):
For "text_mention" only, the mentioned user.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.