Add support for pinned messages in search_messages
This commit is contained in:
parent
418ad164a0
commit
80f8010d50
@ -41,6 +41,7 @@ class Filters:
|
|||||||
MENTION = raw.types.InputMessagesFilterMyMentions()
|
MENTION = raw.types.InputMessagesFilterMyMentions()
|
||||||
LOCATION = raw.types.InputMessagesFilterGeo()
|
LOCATION = raw.types.InputMessagesFilterGeo()
|
||||||
CONTACT = raw.types.InputMessagesFilterContacts()
|
CONTACT = raw.types.InputMessagesFilterContacts()
|
||||||
|
PINNED = raw.types.InputMessagesFilterPinned()
|
||||||
|
|
||||||
|
|
||||||
POSSIBLE_VALUES = list(map(lambda x: x.lower(), filter(lambda x: not x.startswith("__"), Filters.__dict__.keys())))
|
POSSIBLE_VALUES = list(map(lambda x: x.lower(), filter(lambda x: not x.startswith("__"), Filters.__dict__.keys())))
|
||||||
@ -135,6 +136,7 @@ class SearchMessages(Scaffold):
|
|||||||
- ``"mention"``: Search for messages containing mentions to yourself.
|
- ``"mention"``: Search for messages containing mentions to yourself.
|
||||||
- ``"location"``: Search for location messages.
|
- ``"location"``: Search for location messages.
|
||||||
- ``"contact"``: Search for contact messages.
|
- ``"contact"``: Search for contact messages.
|
||||||
|
- ``"pinned"``: Search for pinned messages.
|
||||||
|
|
||||||
limit (``int``, *optional*):
|
limit (``int``, *optional*):
|
||||||
Limits the number of messages to be retrieved.
|
Limits the number of messages to be retrieved.
|
||||||
@ -153,8 +155,12 @@ class SearchMessages(Scaffold):
|
|||||||
for message in app.search_messages("pyrogramchat", query="dan", limit=333):
|
for message in app.search_messages("pyrogramchat", query="dan", limit=333):
|
||||||
print(message.text)
|
print(message.text)
|
||||||
|
|
||||||
# Search for photos sent by @haskell in @pyrogramchat
|
# Search for pinned messages in @pyrogramchat
|
||||||
for message in app.search_messages("pyrogramchat", "", filter="photo" limit=333, from_user="haskell"):
|
for message in app.search_messages("pyrogramchat", filter="pinned"):
|
||||||
|
print(message.text)
|
||||||
|
|
||||||
|
# Search for messages containing "hi" sent by @haskell in @pyrogramchat
|
||||||
|
for message in app.search_messages("pyrogramchat", "hi", from_user="haskell"):
|
||||||
print(message.text)
|
print(message.text)
|
||||||
"""
|
"""
|
||||||
current = 0
|
current = 0
|
||||||
|
Loading…
Reference in New Issue
Block a user