2
0
mirror of https://github.com/pyrogram/pyrogram synced 2025-08-28 21:07:59 +00:00

Add Filter for Callback_Query.data

This commit is contained in:
ColinShark 2019-06-01 23:31:17 +02:00
parent acc0fab311
commit 0a96355c5d

View File

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