node-telegram-api/lib/functions/poll.js

11 lines
232 B
JavaScript
Raw Normal View History

2015-06-29 22:20:34 +00:00
export default function poll(bot) {
return bot.api.getUpdates(bot.update).then(response => {
if (!response.result.length) {
2015-07-05 11:08:07 +00:00
return poll(bot);
2015-06-29 22:20:34 +00:00
}
bot.emit('update', response.result);
2015-07-05 11:08:07 +00:00
return poll(bot);
2015-06-29 22:20:34 +00:00
});
}