mirror of
https://github.com/pyrogram/pyrogram
synced 2025-08-29 05:18:10 +00:00
Add Filter for Callback_Query.data
This commit is contained in:
parent
acc0fab311
commit
0a96355c5d
@ -339,4 +339,19 @@ class Filters:
|
|||||||
and message.from_user.is_self
|
and message.from_user.is_self
|
||||||
and not message.outgoing)))
|
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))
|
dan = create("Dan", lambda _, m: bool(m.from_user and m.from_user.id == 23122162))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user