2
0
mirror of https://github.com/yagop/node-telegram-bot-api synced 2025-08-29 05:17:41 +00:00

Update offset on polling everymessage

This commit is contained in:
Yago 2016-03-13 13:42:46 +01:00
parent 610a989e69
commit 178f9cd905

View File

@ -30,16 +30,13 @@ TelegramBotPolling.prototype._polling = function () {
this.lastUpdate = Date.now();
debug('polling data %j', updates);
updates.forEach(function (update, index) {
// If is the latest, update the offset.
if (index === updates.length - 1) {
this.offset = update.update_id;
debug('updated offset: %s', this.offset);
}
this.offset = update.update_id;
debug('updated offset: %s', this.offset);
this.callback(update);
}.bind(this));
}.bind(this))
.catch(function (err) {
debug('polling error: %j', err);
debug('polling error: %s', err.message);
throw err;
})
.finally(function () {