Common filters#
- pywa.filters.all_(*filters: Callable[[Wa, T], bool]) Callable[[Wa, T], bool]#
Filter for updates that pass all the given filters.
>>> all_(text.startswith("Hello"), text.endswith("Word"))
- pywa.filters.any_(*filters: Callable[[Wa, T], bool]) Callable[[Wa, T], bool]#
Filter for updates that pass any of the given filters.
>>> any_(text.contains("Hello"), text.regex(r"^World"))
- pywa.filters.not_(fil: Callable[[Wa, T], bool]) Callable[[Wa, T], bool]#
Filter for updates that donβt pass the given filter.
>>> not_(text.contains("Hello"))
- pywa.filters.from_users(*numbers: str) MessageFilterT | CallbackFilterT | MessageStatusFilterT#
Filter for messages that are sent from the given numbers.
>>> from_users("+1 555-555-5555", "972123456789")
- pywa.filters.from_countries(*prefixes: str | int) MessageFilterT | CallbackFilterT | MessageStatusFilterT#
Filter for messages that are sent from the given country codes.
See https://countrycode.org/ for a list of country codes.
It is always recommended to restrict the countries that can use your bot. remember that you pay for every conversation that you reply to.
>>> from_countries("972", "1") # Israel and USA