diff --git a/pyrogram/client/filters/filters.py b/pyrogram/client/filters/filters.py index 9c80d870..a3e39117 100644 --- a/pyrogram/client/filters/filters.py +++ b/pyrogram/client/filters/filters.py @@ -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))