node-telegram-api/lib/poll.js
2015-07-05 15:38:07 +04:30

11 lines
232 B
JavaScript

export default function poll(bot) {
return bot.api.getUpdates(bot.update).then(response => {
if (!response.result.length) {
return poll(bot);
}
bot.emit('update', response.result);
return poll(bot);
});
}