diff --git a/pyrogram/filters.py b/pyrogram/filters.py
index 22d407d5a8..a864b8461d 100644
--- a/pyrogram/filters.py
+++ b/pyrogram/filters.py
@@ -25,6 +25,7 @@
from pyrogram.types import (
Message,
CallbackQuery,
+ ChosenInlineResult,
InlineQuery,
InlineKeyboardMarkup,
PreCheckoutQuery,
@@ -1041,6 +1042,7 @@ def regex(pattern: Union[str, Pattern], flags: int = 0) -> Filter:
- :obj:`~pyrogram.types.Message`: The filter will match ``text`` or ``caption``.
- :obj:`~pyrogram.types.CallbackQuery`: The filter will match ``data``.
+ - :obj:`~pyrogram.types.ChosenInlineResult`: The filter will match ``query``.
- :obj:`~pyrogram.types.InlineQuery`: The filter will match ``query``.
- :obj:`~pyrogram.types.PreCheckoutQuery`: The filter will match ``payload``.
@@ -1060,7 +1062,7 @@ async def func(flt, _, update: Update) -> bool:
value: Str = update.text or update.caption
elif isinstance(update, CallbackQuery):
value: str | bytes = update.data
- elif isinstance(update, InlineQuery):
+ elif isinstance(update, (ChosenInlineResult, InlineQuery)):
value: str = update.query
elif isinstance(update, PreCheckoutQuery):
value: str = update.invoice_payload
diff --git a/pyrogram/types/inline_mode/chosen_inline_result.py b/pyrogram/types/inline_mode/chosen_inline_result.py
index a3c7a4e27c..aa93020eba 100644
--- a/pyrogram/types/inline_mode/chosen_inline_result.py
+++ b/pyrogram/types/inline_mode/chosen_inline_result.py
@@ -16,6 +16,7 @@
# You should have received a copy of the GNU Lesser General Public License
# along with Pyrogram. If not, see .
+import re
from typing import Optional
import pyrogram
@@ -49,6 +50,10 @@ class ChosenInlineResult(Object, Update):
Identifier of the sent inline message.
Available only if there is an :doc:`inline keyboard ` attached to the message.
Will be also received in :doc:`callback queries ` and can be used to edit the message.
+
+ matches (List of regex Matches, *optional*):
+ A list containing all `Match Objects `_ that match
+ the query of this inline query. Only applicable when using :obj:`Filters.regex `.
"""
def __init__(
@@ -59,7 +64,8 @@ def __init__(
from_user: "types.User",
query: str,
location: "types.Location" = None,
- inline_message_id: str = None
+ inline_message_id: str = None,
+ matches: list[re.Match] = None
):
super().__init__(client)
@@ -68,6 +74,7 @@ def __init__(
self.query = query
self.location = location
self.inline_message_id = inline_message_id
+ self.matches = matches
@staticmethod
def _parse(client, chosen_inline_result: raw.types.UpdateBotInlineSend, users) -> "ChosenInlineResult":