mirror of
https://github.com/python-telegram-bot/python-telegram-bot.git
synced 2025-03-26 16:38:53 +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>`_
|
- `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>`_
|
||||||
|
|
|
@ -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'
|
||||||
|
|
||||||
|
|
|
@ -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'
|
||||||
|
|
Loading…
Add table
Reference in a new issue