RimMirK
@RimMirK
Вроде человек. Вроде учусь. Вроде пайтону

Как создавать кастом фильтры?

https://docs.pyrogram.org/api/filters#pyrogram.fil...
pyrogram.filters.create(func: Callable, name: str = None, **kwargs) → Filter

Easily create a custom filter.

Custom filters give you extra control over which updates are allowed or not to be processed by your handlers.

Parameters:
func (Callable) – A function that accepts three positional arguments (filter, client, update) and returns a boolean: True if the update should be handled, False otherwise. The filter argument refers to the filter itself and can be used to access keyword arguments (read below). The client argument refers to the Client that received the update. The update argument type will vary depending on which Handler is coming from. For example, in a MessageHandler the update argument will be a Message; in a CallbackQueryHandler the update will be a CallbackQuery. Your function body can then access the incoming update attributes and decide whether to allow it or not.

name (str, optional) – Your filter’s name. Can be anything you like. Defaults to “CustomFilter”.

**kwargs (any, optional) – Any keyword argument you would like to pass. Useful when creating parameterized custom filters, such as command() or regex().


от сюда ничего не понял. Хочу сделать фильтр который вернет тру если сообщение с текстом. Только не пойму где взять инфу о сообщении.
  • Вопрос задан
  • 67 просмотров
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы