Skip to content

Commit

Permalink
Add Filter for Callback_Query.data
Browse files Browse the repository at this point in the history
  • Loading branch information
ColinShark committed Jun 1, 2019
1 parent acc0fab commit 0a96355
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions pyrogram/client/filters/filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -339,4 +339,19 @@ def __call__(self, message):
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))

0 comments on commit 0a96355

Please sign in to comment.