2015-07-05 13:36:27 +00:00
|
|
|
'use strict';
|
|
|
|
|
2016-03-27 20:29:00 +00:00
|
|
|
Object.defineProperty(exports, "__esModule", {
|
2015-07-05 13:36:27 +00:00
|
|
|
value: true
|
|
|
|
});
|
2016-03-27 20:29:00 +00:00
|
|
|
exports.default = poll;
|
2015-07-05 13:36:27 +00:00
|
|
|
function poll(bot) {
|
|
|
|
return bot.api.getUpdates(bot.update).then(function (response) {
|
|
|
|
if (!response.result.length) {
|
|
|
|
return poll(bot);
|
|
|
|
}
|
|
|
|
bot.emit('update', response.result);
|
|
|
|
|
2016-03-27 20:38:42 +00:00
|
|
|
if (bot._stop) {
|
|
|
|
return null;
|
|
|
|
}
|
2015-07-05 13:36:27 +00:00
|
|
|
return poll(bot);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
module.exports = exports['default'];
|