Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does mean parameter offset in function get_inline_bot_results?

I cannot understand what parameter offset did in this function and what's kind of values accept? I try use integers but there is no effect.

from pyrogram import Client, filters
import time


app = Client(
    "my_account",
    api_id=api_id, api_hash=api_hash,
)


async def main():
    async with app:
        bot_results = await app.get_inline_bot_results(
            "some_bot_name",
            query="some_query",
            offset="???"
        )


app.run(main())
like image 698
Артём Липаткин Avatar asked Aug 12 '26 16:08

Артём Липаткин


1 Answers

The documentation states:

offset (str, optional) – Offset of the results to be returned.

Which is not super helpful but from the Telegram Docs shows that it is used for pagination:

offset - If the user scrolls past the first len(results) results, and next_offset field is set, the inline query should be repeated with this offset.

Checking the string documentation and [this] GitHub issue, it seems that the offset should be a string of an int like: "0" or "100". Make sure the returned results' length is more than 1 and set the offset to "1".

like image 81
DoneForAiur Avatar answered Aug 15 '26 06:08

DoneForAiur



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!