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 a caption_entity filter for filtering caption entities #1068

Merged
merged 2 commits into from Apr 20, 2018

Conversation

Projects
None yet
3 participants
@PaulSonOfLars
Contributor

PaulSonOfLars commented Apr 8, 2018

Currently, the Filters.entity filter only checks message.entities.
This PR adds Filters.caption_entities to check message.caption_entities.

@PaulSonOfLars

This comment has been minimized.

Show comment
Hide comment
@PaulSonOfLars

PaulSonOfLars Apr 8, 2018

Contributor

I think it'd also be nice to have one filter for both entity types, but having trouble naming it; all_entity, any_entity, either_entity, both_entity all seem kinda misleading.

Contributor

PaulSonOfLars commented Apr 8, 2018

I think it'd also be nice to have one filter for both entity types, but having trouble naming it; all_entity, any_entity, either_entity, both_entity all seem kinda misleading.

@keessonnema

This comment has been minimized.

Show comment
Hide comment
@keessonnema

keessonnema Apr 17, 2018

This would be really helpful. Code looks good aswell. +1

keessonnema commented Apr 17, 2018

This would be really helpful. Code looks good aswell. +1

@jh0ker

jh0ker approved these changes Apr 20, 2018

LGTM 👍

@@ -532,7 +532,28 @@ def __init__(self, entity_type):
self.name = 'Filters.entity({})'.format(self.entity_type)
def filter(self, message):
return any([entity.type == self.entity_type for entity in message.entities])
return any(entity.type == self.entity_type for entity in message.entities)

This comment has been minimized.

@jh0ker

jh0ker Apr 20, 2018

Member

Thanks for fixing this too 😄

@jh0ker

jh0ker Apr 20, 2018

Member

Thanks for fixing this too 😄

@jh0ker jh0ker merged commit b5196f0 into python-telegram-bot:master Apr 20, 2018

2 of 3 checks passed

continuous-integration/appveyor/pr AppVeyor build failed
Details
Hound No violations found. Woof!
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@jh0ker

This comment has been minimized.

Show comment
Hide comment
@jh0ker

jh0ker Apr 20, 2018

Member

Thanks for your contribution 🙂

Member

jh0ker commented Apr 20, 2018

Thanks for your contribution 🙂

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