mirror of
https://github.com/aiogram/aiogram.git
synced 2025-12-11 01:54:53 +00:00
Merge pull request #92 from gabbhack/patch-1
Fix Text filter for InlineQuery
This commit is contained in:
commit
6fb644e4c8
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 import types
|
||||||
from aiogram.dispatcher.filters.filters import BoundFilter, Filter
|
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
|
from aiogram.utils.deprecated import warn_deprecated
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -159,11 +159,13 @@ class Text(Filter):
|
||||||
elif 'text_endswith' in full_config:
|
elif 'text_endswith' in full_config:
|
||||||
return {'endswith': full_config.pop('text_endswith')}
|
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):
|
if isinstance(obj, Message):
|
||||||
text = obj.text or obj.caption or ''
|
text = obj.text or obj.caption or ''
|
||||||
elif isinstance(obj, CallbackQuery):
|
elif isinstance(obj, CallbackQuery):
|
||||||
text = obj.data
|
text = obj.data
|
||||||
|
elif isinstance(obj, InlineQuery):
|
||||||
|
text = obj.query
|
||||||
else:
|
else:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue