mirror of
https://github.com/python-telegram-bot/python-telegram-bot.git
synced 2025-01-03 17:52:31 +01:00
Add Filters.update.edited (#2705)
This commit is contained in:
parent
1edfa1504c
commit
99581abe05
2 changed files with 15 additions and 0 deletions
|
@ -2247,6 +2247,15 @@ officedocument.wordprocessingml.document")``.
|
|||
|
||||
edited_channel_post = _EditedChannelPost()
|
||||
|
||||
class _Edited(UpdateFilter):
|
||||
__slots__ = ()
|
||||
name = 'Filters.update.edited'
|
||||
|
||||
def filter(self, update: Update) -> bool:
|
||||
return update.edited_message is not None or update.edited_channel_post is not None
|
||||
|
||||
edited = _Edited()
|
||||
|
||||
class _ChannelPosts(UpdateFilter):
|
||||
__slots__ = ()
|
||||
name = 'Filters.update.channel_posts'
|
||||
|
@ -2277,4 +2286,6 @@ officedocument.wordprocessingml.document")``.
|
|||
:attr:`telegram.Update.edited_channel_post`
|
||||
channel_posts: Updates with either :attr:`telegram.Update.channel_post` or
|
||||
:attr:`telegram.Update.edited_channel_post`
|
||||
edited: Updates with either :attr:`telegram.Update.edited_message` or
|
||||
:attr:`telegram.Update.edited_channel_post`
|
||||
"""
|
||||
|
|
|
@ -1951,6 +1951,7 @@ class TestFilters:
|
|||
assert not Filters.update.channel_post(update)
|
||||
assert not Filters.update.edited_channel_post(update)
|
||||
assert not Filters.update.channel_posts(update)
|
||||
assert not Filters.update.edited(update)
|
||||
assert Filters.update(update)
|
||||
|
||||
def test_update_type_edited_message(self, update):
|
||||
|
@ -1961,6 +1962,7 @@ class TestFilters:
|
|||
assert not Filters.update.channel_post(update)
|
||||
assert not Filters.update.edited_channel_post(update)
|
||||
assert not Filters.update.channel_posts(update)
|
||||
assert Filters.update.edited(update)
|
||||
assert Filters.update(update)
|
||||
|
||||
def test_update_type_channel_post(self, update):
|
||||
|
@ -1971,6 +1973,7 @@ class TestFilters:
|
|||
assert Filters.update.channel_post(update)
|
||||
assert not Filters.update.edited_channel_post(update)
|
||||
assert Filters.update.channel_posts(update)
|
||||
assert not Filters.update.edited(update)
|
||||
assert Filters.update(update)
|
||||
|
||||
def test_update_type_edited_channel_post(self, update):
|
||||
|
@ -1981,6 +1984,7 @@ class TestFilters:
|
|||
assert not Filters.update.channel_post(update)
|
||||
assert Filters.update.edited_channel_post(update)
|
||||
assert Filters.update.channel_posts(update)
|
||||
assert Filters.update.edited(update)
|
||||
assert Filters.update(update)
|
||||
|
||||
def test_merged_short_circuit_and(self, update, base_class):
|
||||
|
|
Loading…
Reference in a new issue