Skip to content

Commit 5f55b70

Browse files
committed
Add users_shared and chat_shared filters
Fix documentation of filters.media
1 parent 9f5bb60 commit 5f55b70

File tree

2 files changed

+26
-2
lines changed

2 files changed

+26
-2
lines changed

docs/source/releases/changes-in-this-fork.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ it can take advantage of new goodies!
1212
| Scheme layer used: 177 |
1313
+------------------------+
1414

15+
- Added ``filters.users_shared`` and ``filters.chat_shared``.
1516
- Added the field ``origin`` of type :obj:`~pyrogram.types.MessageOrigin`` in the class :obj:`~pyrogram.types.ExternalReplyInfo`.
1617
- Added the class :obj:`~pyrogram.types.MessageOrigin` and replaced the fields ``forward_from``, ``forward_from_chat``, ``forward_from_message_id``, ``forward_signature``, ``forward_sender_name``, and ``forward_date`` with the field ``forward_origin`` of type :obj:`~pyrogram.types.MessageOrigin`` in the class :obj:`~pyrogram.types.Message`.
1718
- Added ``accent_color``, ``profile_color``, ``emoji_status``, ``is_close_friend`` to :obj:`~pyrogram.types.Chat` and :obj:`~pyrogram.types.User`.

pyrogram/filters.py

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -774,8 +774,7 @@ async def media_filter(_, __, m: Message) -> bool:
774774
media: Filter = create(media_filter)
775775
"""Filter media messages.
776776
777-
A media message contains any of the following fields set: *audio*, *document*, *photo*, *sticker*, *video*,
778-
*animation*, *voice*, *video_note*, *contact*, *location*, *venue*, *poll*.
777+
A media message contains any of the following fields set: *animation*, *audio*, *contact*, *dice*, *document*, *game*, *giveaway*, *giveaway_winners*, *location*, *photo*, *poll*, *sticker*, *story*, *venue*, *video*, *video_note*, *voice*, *web_page*.
779778
"""
780779

781780

@@ -1057,3 +1056,27 @@ async def __call__(self, _, message: Message) -> bool:
10571056
and not message.outgoing
10581057
)
10591058
)
1059+
1060+
1061+
# region chat_shared filter
1062+
1063+
chat_shared: Filter = create(
1064+
lambda _, __, m: (
1065+
bool(m.chat_shared)
1066+
)
1067+
)
1068+
"""Filter service messages for chat shared."""
1069+
1070+
# endregion
1071+
1072+
1073+
# region users_shared filter
1074+
1075+
users_shared: Filter = create(
1076+
lambda _, __, m: (
1077+
bool(m.users_shared)
1078+
)
1079+
)
1080+
"""Filter service messages for chat shared."""
1081+
1082+
# endregion

0 commit comments

Comments
 (0)