Update bot.py

This commit is contained in:
xlf1024 2018-03-21 22:24:28 +01:00 committed by GitHub
parent 47300c0fb6
commit bb41fa4e46
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

7
bot.py
View file

@ -636,10 +636,13 @@ def reply_to_query(bot, update):
if players and game and len(players) > 1: if players and game and len(players) > 1:
switch = _('Current game: {game}').format(game=game.chat.title) switch = _('Current game: {game}').format(game=game.chat.title)
# Pagination. This is necessary as the Telegram servers discard inline query answers with more than 50 entries.
offset = int(update.inline_query.offset) if update.inline_query.offset != None and update.inline_query.offset.isnumeric() else 0 offset = int(update.inline_query.offset) if update.inline_query.offset != None and update.inline_query.offset.isnumeric() else 0
results = results[offset : offset+42] next_offset = offset + 42
results = results[offset : next_offset]
answer_async(bot, update.inline_query.id, results, cache_time=0, answer_async(bot, update.inline_query.id, results, cache_time=0,
switch_pm_text=switch, switch_pm_parameter='select', next_offset=str(offset+42)) switch_pm_text=switch, switch_pm_parameter='select', next_offset=str(next_offset))
@game_locales @game_locales