1
0
mirror of https://github.com/eternnoir/pyTelegramBotAPI.git synced 2023-08-10 21:12:57 +03:00

Implemented the offset parameter.

Implemented the offset parameter for the getUpdates API call according to https://core.telegram.org/bots/api#getupdates
In short: the offset is calculated by adding 1 to the id of the last received Update.
Caching messages in a list is now redundant, so the cache is removed. Only the id of the last received Update is kept for future getUpdates calls.
This commit is contained in:
pieter
2015-06-30 05:49:35 +02:00
parent 53c76e75f7
commit 34da2552dd
2 changed files with 10 additions and 27 deletions

View File

@ -1,8 +1,9 @@
# -*- coding: utf-8 -*-
import telebot
import requests
import telebot
def get_me(token):
api_url = telebot.API_URL
@ -124,7 +125,7 @@ def check_result(func_name, result):
try:
result_json = result.json()
if not result_json['ok']:
raise Exception('')
raise Exception(func_name, ' failed, result=' + result_json)
except:
raise ApiError(func_name + r' error.', result)
return result_json