mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2024-12-03 06:43:45 +03:00
Raise TimeoutError from inline_query instead
This commit is contained in:
parent
4d6e75a54e
commit
0eb18f2f5a
|
@ -1,8 +1,9 @@
|
||||||
import typing
|
import typing
|
||||||
|
import asyncio
|
||||||
|
|
||||||
from ..types import _custom
|
from ..types import _custom
|
||||||
from .._misc import hints
|
from .._misc import hints
|
||||||
from .. import _tl
|
from .. import errors, _tl
|
||||||
|
|
||||||
if typing.TYPE_CHECKING:
|
if typing.TYPE_CHECKING:
|
||||||
from .telegramclient import TelegramClient
|
from .telegramclient import TelegramClient
|
||||||
|
@ -22,6 +23,7 @@ async def inline_query(
|
||||||
else:
|
else:
|
||||||
peer = _tl.InputPeerEmpty()
|
peer = _tl.InputPeerEmpty()
|
||||||
|
|
||||||
|
try:
|
||||||
result = await self(_tl.fn.messages.GetInlineBotResults(
|
result = await self(_tl.fn.messages.GetInlineBotResults(
|
||||||
bot=bot,
|
bot=bot,
|
||||||
peer=peer,
|
peer=peer,
|
||||||
|
@ -29,5 +31,7 @@ async def inline_query(
|
||||||
offset=offset or '',
|
offset=offset or '',
|
||||||
geo_point=geo_point
|
geo_point=geo_point
|
||||||
))
|
))
|
||||||
|
except errors.BotResponseTimeoutError:
|
||||||
|
raise asyncio.TimeoutError from None
|
||||||
|
|
||||||
return _custom.InlineResults(self, result, entity=peer if dialog else None)
|
return _custom.InlineResults(self, result, entity=peer if dialog else None)
|
||||||
|
|
|
@ -733,6 +733,10 @@ class TelegramClient:
|
||||||
The geo point location information to send to the bot
|
The geo point location information to send to the bot
|
||||||
for localised results. Available under some bots.
|
for localised results. Available under some bots.
|
||||||
|
|
||||||
|
Raises
|
||||||
|
If the bot does not respond to the inline query in time,
|
||||||
|
`asyncio.TimeoutError` is raised. The timeout is decided by Telegram.
|
||||||
|
|
||||||
Returns
|
Returns
|
||||||
A list of `_custom.InlineResult
|
A list of `_custom.InlineResult
|
||||||
<telethon.tl._custom.inlineresult.InlineResult>`.
|
<telethon.tl._custom.inlineresult.InlineResult>`.
|
||||||
|
|
Loading…
Reference in New Issue
Block a user