Fix args being empty

This commit is contained in:
Mahdi Dibaiee 2015-07-09 16:07:08 +04:30
parent a9473d1ee8
commit f88927e970
3 changed files with 10 additions and 3 deletions

View File

@ -202,6 +202,8 @@ var Bot = (function (_EventEmitter) {
this.update.offset += 1;
}
console.log(update);
update.forEach(function (res) {
var marked3$0 = [getAnswer].map(regeneratorRuntime.mark);
@ -237,10 +239,14 @@ var Bot = (function (_EventEmitter) {
var params = _ev$parse.params;
var args = _ev$parse.args;
res.message.args = args;
var requiredParams = Object.keys(params).filter(function (param) {
return params[param] === REQUIRED && !args[param];
});
console.log(requiredParams);
if (!requiredParams.length) {
ev.listener(res.message);
return;
@ -337,7 +343,6 @@ var Bot = (function (_EventEmitter) {
(function loop() {
var next = iterator.next();
if (next.done) {
res.message.args = args;
ev.listener(res.message);
return;
}

View File

@ -148,6 +148,8 @@ export default class Bot extends EventEmitter {
this.update.offset += 1;
}
console.log(update);
update.forEach(res => {
let text = res.message.text;
if (!text) return;
@ -174,6 +176,7 @@ export default class Bot extends EventEmitter {
}
let {params, args} = ev.parse(res.message.text);
res.message.args = args;
const requiredParams = Object.keys(params).filter(param => {
return params[param] === REQUIRED && !args[param];
@ -199,7 +202,6 @@ export default class Bot extends EventEmitter {
(function loop() {
const next = iterator.next();
if (next.done) {
res.message.args = args;
ev.listener(res.message);
return;
}

View File

@ -1,6 +1,6 @@
{
"name": "telegram-api",
"version": "0.5.10",
"version": "0.5.11",
"description": "Control Telegram bots easily using the new Telegram API",
"main": "index.js",
"scripts": {