-
Notifications
You must be signed in to change notification settings - Fork 5.9k
Add get_entity to Message. (Fixes #400) #404
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
Conversation
Should close python-telegram-bot#400.
|
Good work @bomjacob! I think at this point it makes sense to add a |
|
Danm.. I wrote that before I saw what you wrote @jh0ker. I'll pull the possible values out and add them as a constant instead. |
Also makes `get_entities` use it.
|
Was that what you had in mind in terms of constant @jh0ker ? |
|
Want them to be in the |
|
Yeah in the |
|
You renamed it to |
|
Forgot to push :P |
|
Don't merge yet. I wanna quickly write a test. |
Also change the test for get_entity slightly.. the setUp isn't actually needed at all.
|
Should this be changed? Like do I need to specify that it's a list of MessageEntity types somehow, or is this okay? |
|
I think most docstrings have to be updated since they are referring to text instead of entities. Additionally, it might be a good idea to document when and why you should not use Also, maybe it would be a good idea to rename |
Renames get_entity to get_entity_text. Change docstrings to hopefully be more descriptive.
|
While discussing with @bomjacob, we were re-thinking the Possible courses of action:
|
Also make parse_entities return a dict {MessageEntity: text} instead of a MessageEntiy.
|
Alright. It's been decited to go with: "Remove it completely and instead return a dict from get_entities that maps a MessageEntity to their text" |
|
We might need an extra snippet at the end of https://github.com/python-telegram-bot/python-telegram-bot/wiki/Code-snippets for this. |
Not sure if the docstring is correct...
Also this PR should be squashed, since it has some derpy commits.