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:
parent
610a989e69
commit
178f9cd905
@ -30,16 +30,13 @@ TelegramBotPolling.prototype._polling = function () {
|
|||||||
this.lastUpdate = Date.now();
|
this.lastUpdate = Date.now();
|
||||||
debug('polling data %j', updates);
|
debug('polling data %j', updates);
|
||||||
updates.forEach(function (update, index) {
|
updates.forEach(function (update, index) {
|
||||||
// If is the latest, update the offset.
|
this.offset = update.update_id;
|
||||||
if (index === updates.length - 1) {
|
debug('updated offset: %s', this.offset);
|
||||||
this.offset = update.update_id;
|
|
||||||
debug('updated offset: %s', this.offset);
|
|
||||||
}
|
|
||||||
this.callback(update);
|
this.callback(update);
|
||||||
}.bind(this));
|
}.bind(this));
|
||||||
}.bind(this))
|
}.bind(this))
|
||||||
.catch(function (err) {
|
.catch(function (err) {
|
||||||
debug('polling error: %j', err);
|
debug('polling error: %s', err.message);
|
||||||
throw err;
|
throw err;
|
||||||
})
|
})
|
||||||
.finally(function () {
|
.finally(function () {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user