Skip to content

entities add #375

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

Closed
wants to merge 1 commit into from
Closed

entities add #375

wants to merge 1 commit into from

Conversation

evstratbg
Copy link

Telegram's update message has new entities, described here https://core.telegram.org/bots/API#messageentity
I've added some, and fix command, according to docs.
If bot receives smth like test@test.com /start, update has such tuple:
'entities': [{'length': 12, 'offset': 0, 'type': 'email'}, {'length': 5, 'offset': 0, 'type': 'bot_command'}]
which is neither a bot_command nor an email

Still, devs can parse an entity, using indexes of the dicts and a length in an entity list

Telegram's update message has new entities, described here https://core.telegram.org/bots/API#messageentity
I've added some, and fix command, according to docs.
If bot receives smth like test@test.com /start, update has such tuple:
'entities': [{'length': 12, 'offset': 0, 'type': 'email'}, {'length': 5, 'offset': 0, 'type': 'bot_command'}]
which is neither a bot_command nor an email

Still, devs can parse an entity, using indexes of the dicts and a length in an entity list
@jh0ker
Copy link
Member

jh0ker commented Aug 23, 2016

Hey, thank you for your contribution!

I'm wondering, you only accept the message if there is only one entity in the message... that could be confusing (at least to me it is). Wouldn't it be more intuitive to check if any of the entities is the one we are searching for?

Another thing: Could we then perhaps have some kind of higher-order function that you can use like this_

def entities(list_of_entities):
    # return a new function that checks the message for those entities

and then

MessageHandler([entities(MENTION, TEXT_MENTION)])

What do you think?

@jh0ker jh0ker added enhancement 📋 pending-reply work status: pending-reply labels Aug 25, 2016
jsmnbom added a commit that referenced this pull request Sep 13, 2016
Should ideally superseed #375.
@jsmnbom jsmnbom mentioned this pull request Sep 13, 2016
@jsmnbom
Copy link
Member

jsmnbom commented Sep 24, 2016

Superseeded by #409

@jsmnbom jsmnbom closed this Sep 24, 2016
@github-actions github-actions bot locked and limited conversation to collaborators Aug 24, 2020
@Bibo-Joshi Bibo-Joshi added 🔌 enhancement pr description: enhancement and removed enhancement labels Nov 3, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
🔌 enhancement pr description: enhancement 📋 pending-reply work status: pending-reply
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy