mirror of
https://github.com/aiogram/aiogram.git
synced 2026-04-08 16:37:47 +00:00
Add InlineQuery.answer
This commit is contained in:
parent
6bba2da814
commit
65002b9280
4 changed files with 67 additions and 1 deletions
|
|
@ -1,6 +1,6 @@
|
|||
from __future__ import annotations
|
||||
|
||||
from typing import TYPE_CHECKING, Optional
|
||||
from typing import TYPE_CHECKING, List, Optional
|
||||
|
||||
from pydantic import Field
|
||||
|
||||
|
|
@ -9,6 +9,8 @@ from .base import TelegramObject
|
|||
if TYPE_CHECKING: # pragma: no cover
|
||||
from .location import Location
|
||||
from .user import User
|
||||
from .inline_query_result import InlineQueryResult
|
||||
from ..methods import AnswerInlineQuery
|
||||
|
||||
|
||||
class InlineQuery(TelegramObject):
|
||||
|
|
@ -29,3 +31,33 @@ class InlineQuery(TelegramObject):
|
|||
"""Offset of the results to be returned, can be controlled by the bot"""
|
||||
location: Optional[Location] = None
|
||||
"""Sender location, only for bots that request user location"""
|
||||
|
||||
def answer(
|
||||
self,
|
||||
results: List[InlineQueryResult],
|
||||
cache_time: Optional[int] = None,
|
||||
is_personal: Optional[bool] = None,
|
||||
next_offset: Optional[str] = None,
|
||||
switch_pm_text: Optional[str] = None,
|
||||
switch_pm_parameter: Optional[str] = None,
|
||||
) -> AnswerInlineQuery:
|
||||
"""
|
||||
:param results:
|
||||
:param cache_time:
|
||||
:param is_personal:
|
||||
:param next_offset:
|
||||
:param switch_pm_text:
|
||||
:param switch_pm_parameter:
|
||||
:return:
|
||||
"""
|
||||
from ..methods import AnswerInlineQuery
|
||||
|
||||
return AnswerInlineQuery(
|
||||
inline_query_id=self.id,
|
||||
results=results,
|
||||
cache_time=cache_time,
|
||||
is_personal=is_personal,
|
||||
next_offset=next_offset,
|
||||
switch_pm_text=switch_pm_text,
|
||||
switch_pm_parameter=switch_pm_parameter,
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue