Added video note filter (#1067)

This commit is contained in:
Or Bin 2018-04-14 22:53:54 +03:00 committed by Jannes Höke
parent 59659eaf5e
commit 712baf0c07
3 changed files with 15 additions and 0 deletions

View file

@ -53,6 +53,7 @@ The following wonderful people contributed directly or indirectly to this projec
- `Noam Meltzer <https://github.com/tsnoam>`_ - `Noam Meltzer <https://github.com/tsnoam>`_
- `Oleg Shlyazhko <https://github.com/ollmer>`_ - `Oleg Shlyazhko <https://github.com/ollmer>`_
- `Oleg Sushchenko <https://github.com/feuillemorte>`_ - `Oleg Sushchenko <https://github.com/feuillemorte>`_
- `Or Bin <https://github.com/OrBin>`_
- `overquota <https://github.com/overquota>`_ - `overquota <https://github.com/overquota>`_
- `Patrick Hofmann <https://github.com/PH89>`_ - `Patrick Hofmann <https://github.com/PH89>`_
- `Paul Larsen <https://github.com/PaulSonOfLars>`_ - `Paul Larsen <https://github.com/PaulSonOfLars>`_

View file

@ -336,6 +336,15 @@ class Filters(object):
voice = _Voice() voice = _Voice()
""":obj:`Filter`: Messages that contain :class:`telegram.Voice`.""" """:obj:`Filter`: Messages that contain :class:`telegram.Voice`."""
class _VideoNote(BaseFilter):
name = 'Filters.video_note'
def filter(self, message):
return bool(message.video_note)
video_note = _VideoNote()
""":obj:`Filter`: Messages that contain :class:`telegram.VideoNote`."""
class _Contact(BaseFilter): class _Contact(BaseFilter):
name = 'Filters.contact' name = 'Filters.contact'

View file

@ -205,6 +205,11 @@ class TestFilters(object):
message.voice = 'test' message.voice = 'test'
assert Filters.voice(message) assert Filters.voice(message)
def test_filters_video_note(self, message):
assert not Filters.video_note(message)
message.video_note = 'test'
assert Filters.video_note(message)
def test_filters_contact(self, message): def test_filters_contact(self, message):
assert not Filters.contact(message) assert not Filters.contact(message)
message.contact = 'test' message.contact = 'test'