Document new errors and limits for inline results

This commit is contained in:
Lonami Exo 2019-02-14 19:45:25 +01:00
parent 41bfb8ae52
commit 628a16f287
3 changed files with 17 additions and 2 deletions

View File

@ -145,6 +145,12 @@ class InlineQuery(EventBuilder):
r2 = builder.article('Be bad', text="I don't like you")
await inline.answer([r1, r2])
You can send up to 50 results as documented in
https://core.telegram.org/bots/api#answerinlinequery.
Sending more will raise ``ResultsTooMuchError``,
and you should consider using `next_offset` to
paginate them.
cache_time (`int`, optional):
For how long this result should be cached on
the user's client. Defaults to 0 for no cache.

View File

@ -43,8 +43,15 @@ class InlineBuilder:
id (`str`, optional):
The string ID to use for this result. If not present, it
will be the SHA256 hexadecimal digest of converting the
request with empty ID to ``bytes()``, so that the ID will
be deterministic for the same input.
created :tl:`InputBotInlineResult` with empty ID to ``bytes()``,
so that the ID will be deterministic for the same input.
.. note::
If two inputs are exactly the same, their IDs will be the same
too. If you send two articles with the same ID, it will raise
``ResultIdDuplicateError``. Consider giving them an explicit
ID if you need to send two results that are the same.
"""
def __init__(self, client):
self._client = client

View File

@ -187,7 +187,9 @@ RANGES_INVALID,400,Invalid range provided
REG_ID_GENERATE_FAILED,500,Failure while generating registration ID
REPLY_MARKUP_INVALID,400,The provided reply markup is invalid
REPLY_MARKUP_TOO_LONG,400,The data embedded in the reply markup buttons was too much
RESULT_ID_DUPLICATE,400,Duplicated IDs on the sent results. Make sure to use unique IDs.
RESULT_TYPE_INVALID,400,Result type invalid
RESULTS_TOO_MUCH,400,You sent too many results. See https://core.telegram.org/bots/api#answerinlinequery for the current limit.
RIGHT_FORBIDDEN,403,Your admin rights do not allow you to do this
RPC_CALL_FAIL,,"Telegram is having internal issues, please try again later."
RPC_MCGET_FAIL,,"Telegram is having internal issues, please try again later."

1 name codes description
187 REG_ID_GENERATE_FAILED 500 Failure while generating registration ID
188 REPLY_MARKUP_INVALID 400 The provided reply markup is invalid
189 REPLY_MARKUP_TOO_LONG 400 The data embedded in the reply markup buttons was too much
190 RESULT_ID_DUPLICATE 400 Duplicated IDs on the sent results. Make sure to use unique IDs.
191 RESULT_TYPE_INVALID 400 Result type invalid
192 RESULTS_TOO_MUCH 400 You sent too many results. See https://core.telegram.org/bots/api#answerinlinequery for the current limit.
193 RIGHT_FORBIDDEN 403 Your admin rights do not allow you to do this
194 RPC_CALL_FAIL Telegram is having internal issues, please try again later.
195 RPC_MCGET_FAIL Telegram is having internal issues, please try again later.