Telethon/telethon/_client/bots.py

34 lines
841 B
Python
Raw Normal View History

import typing
2021-09-12 17:58:06 +03:00
from ..types import _custom
from .._misc import hints
from .. import _tl
2018-08-01 02:06:47 +03:00
if typing.TYPE_CHECKING:
from .telegramclient import TelegramClient
2018-08-01 02:06:47 +03:00
async def inline_query(
self: 'TelegramClient',
bot: 'hints.EntityLike',
query: str,
*,
entity: 'hints.EntityLike' = None,
offset: str = None,
2021-09-12 17:58:06 +03:00
geo_point: '_tl.GeoPoint' = None) -> _custom.InlineResults:
bot = await self.get_input_entity(bot)
if entity:
peer = await self.get_input_entity(entity)
else:
peer = _tl.InputPeerEmpty()
result = await self(_tl.fn.messages.GetInlineBotResults(
bot=bot,
peer=peer,
query=query,
offset=offset or '',
geo_point=geo_point
))
2021-09-12 17:58:06 +03:00
return _custom.InlineResults(self, result, entity=peer if entity else None)