From 6404862b878ba7c6deff3046d236d71c0ff26946 Mon Sep 17 00:00:00 2001 From: Dan <14043624+delivrance@users.noreply.github.com> Date: Sat, 23 Jun 2018 10:36:29 +0200 Subject: [PATCH] Add reply_keyboard and inline_keyboard filters --- pyrogram/client/filters/filters.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pyrogram/client/filters/filters.py b/pyrogram/client/filters/filters.py index 26aa84c8..133ab6c2 100644 --- a/pyrogram/client/filters/filters.py +++ b/pyrogram/client/filters/filters.py @@ -19,6 +19,7 @@ import re from .filter import Filter +from ..types.reply_markup import InlineKeyboardMarkup, ReplyKeyboardMarkup def build(name: str, func: callable, **kwargs) -> type: @@ -131,7 +132,11 @@ class Filters: pinned_message = build("PinnedMessage", lambda _, m: bool(m.pinned_message)) """Filter service messages for pinned messages.""" - # TODO: Add filters for reply markups + reply_keyboard = build("ReplyKeyboard", lambda _, m: isinstance(m.reply_markup, ReplyKeyboardMarkup)) + """Filter messages containing reply keyboard markups""" + + inline_keyboard = build("InlineKeyboard", lambda _, m: isinstance(m.reply_markup, InlineKeyboardMarkup)) + """Filter messages containing inline keyboard markups""" @staticmethod def command(command: str or list,