mirror of
https://github.com/aiogram/aiogram.git
synced 2025-12-09 09:22:03 +00:00
Fix Text filter for InlineQuery
This commit is contained in:
parent
9bc170231d
commit
44c74a367c
1 changed files with 4 additions and 2 deletions
|
|
@ -6,7 +6,7 @@ from typing import Any, Dict, Iterable, Optional, Union
|
|||
|
||||
from aiogram import types
|
||||
from aiogram.dispatcher.filters.filters import BoundFilter, Filter
|
||||
from aiogram.types import CallbackQuery, Message
|
||||
from aiogram.types import CallbackQuery, Message, InlineQuery
|
||||
from aiogram.utils.deprecated import warn_deprecated
|
||||
|
||||
|
||||
|
|
@ -159,11 +159,13 @@ class Text(Filter):
|
|||
elif 'text_endswith' in full_config:
|
||||
return {'endswith': full_config.pop('text_endswith')}
|
||||
|
||||
async def check(self, obj: Union[Message, CallbackQuery]):
|
||||
async def check(self, obj: Union[Message, CallbackQuery, InlineQuery]):
|
||||
if isinstance(obj, Message):
|
||||
text = obj.text or obj.caption or ''
|
||||
elif isinstance(obj, CallbackQuery):
|
||||
text = obj.data
|
||||
elif isinstance(obj, InlineQuery):
|
||||
text = obj.query
|
||||
else:
|
||||
return False
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue