botogram icon indicating copy to clipboard operation
botogram copied to clipboard

Add support for inline queries

Open pietroalbini opened this issue 9 years ago • 3 comments

Telegram bots now supports inline queries, which allows the bot to provide information even if it isn't in that specific group. I plan to implement the feature with the following API:

@bot.inline(cache=60, private=True, paginate=10)
def process_inline(user, query):
    if not query:
        return False  # do not send the replies
    i = 1
    while True:
        # Send an article with `i` as the title and "A number" as the content
        yield botogram.inline_article(str(i), "A number")
        i += 1

Because it's implemented as a generator, it's possible to implement pagination framework-side without processing every item you might send. In the example above, most of the times you will process only the first 10-20 numbers, but the user is able to scroll down how much he wants.

pietroalbini avatar Jan 01 '16 13:01 pietroalbini

how to implement this new feature in php?

liz7124 avatar Jan 05 '16 09:01 liz7124

@liz7124 please refer to the Telegram documentation. Also, this is completly off-topic on this repository, botogram is written in Python :)

pietroalbini avatar Jan 05 '16 12:01 pietroalbini

Oohh,i see.. Thank you :)

liz7124 avatar Jan 06 '16 05:01 liz7124