mirror of
https://github.com/python-telegram-bot/python-telegram-bot.git
synced 2025-03-27 08:50:38 +01:00
Added video note filter (#1067)
This commit is contained in:
parent
59659eaf5e
commit
712baf0c07
3 changed files with 15 additions and 0 deletions
|
@ -53,6 +53,7 @@ The following wonderful people contributed directly or indirectly to this projec
|
|||
- `Noam Meltzer <https://github.com/tsnoam>`_
|
||||
- `Oleg Shlyazhko <https://github.com/ollmer>`_
|
||||
- `Oleg Sushchenko <https://github.com/feuillemorte>`_
|
||||
- `Or Bin <https://github.com/OrBin>`_
|
||||
- `overquota <https://github.com/overquota>`_
|
||||
- `Patrick Hofmann <https://github.com/PH89>`_
|
||||
- `Paul Larsen <https://github.com/PaulSonOfLars>`_
|
||||
|
|
|
@ -336,6 +336,15 @@ class Filters(object):
|
|||
voice = _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):
|
||||
name = 'Filters.contact'
|
||||
|
||||
|
|
|
@ -205,6 +205,11 @@ class TestFilters(object):
|
|||
message.voice = 'test'
|
||||
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):
|
||||
assert not Filters.contact(message)
|
||||
message.contact = 'test'
|
||||
|
|
Loading…
Add table
Reference in a new issue