Skip to content

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