feat(stop): ability to stop bot from listening on updates

resolve #12
This commit is contained in:
Mahdi Dibaiee
2015-11-08 06:52:06 +03:30
parent 82961d7fa5
commit cdb5adc71f
8 changed files with 47 additions and 16 deletions

View File

@ -12,6 +12,7 @@ function poll(bot) {
}
bot.emit('update', response.result);
if (bot._stop) return null;
return poll(bot);
});
}

View File

@ -29,7 +29,7 @@ function webhook(options, bot) {
return bot.api.setWebhook(options.url).then(function () {
_http2['default'].createServer(options.server, function (req, res) {
bot._webhookServer = _http2['default'].createServer(options.server, function (req, res) {
return (0, _fetch.getBody)(req).then(function (data) {
bot.emit('update', _qs2['default'].parse(data).result);