Fix required arguments

This commit is contained in:
Mahdi Dibaiee 2015-07-09 16:00:01 +04:30
parent 41ca326173
commit a9473d1ee8
3 changed files with 5 additions and 3 deletions

View File

@ -238,7 +238,7 @@ var Bot = (function (_EventEmitter) {
var args = _ev$parse.args;
var requiredParams = Object.keys(params).filter(function (param) {
return params[param] === REQUIRED;
return params[param] === REQUIRED && !args[param];
});
if (!requiredParams.length) {
@ -337,6 +337,7 @@ var Bot = (function (_EventEmitter) {
(function loop() {
var next = iterator.next();
if (next.done) {
res.message.args = args;
ev.listener(res.message);
return;
}

View File

@ -176,7 +176,7 @@ export default class Bot extends EventEmitter {
let {params, args} = ev.parse(res.message.text);
const requiredParams = Object.keys(params).filter(param => {
return params[param] === REQUIRED;
return params[param] === REQUIRED && !args[param];
});
if (!requiredParams.length) {
@ -199,6 +199,7 @@ 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.00",
"version": "0.5.10",
"description": "Control Telegram bots easily using the new Telegram API",
"main": "index.js",
"scripts": {