Fix required arguments
This commit is contained in:
parent
41ca326173
commit
a9473d1ee8
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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": {
|
||||
|
Loading…
Reference in New Issue
Block a user