2
0
mirror of https://github.com/pyrogram/pyrogram synced 2025-08-28 12:57:52 +00:00

Merge pull request #248 from ColinTheShark/develop

Add Filter for Callback_Query.data
This commit is contained in:
Dan 2019-06-02 00:31:03 +02:00 committed by GitHub
commit c0a2b4601a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -339,4 +339,15 @@ class Filters:
and message.from_user.is_self
and not message.outgoing)))
@staticmethod
def callback_data(data: str or bytes):
"""Filter callback queries for their data.
Parameters:
data (``str`` | ``bytes``):
Pass the data you want to filter for.
"""
return create("CallbackData", lambda flt, cb: cb.data == flt.data, data=data)
dan = create("Dan", lambda _, m: bool(m.from_user and m.from_user.id == 23122162))