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 args = _ev$parse.args;
|
||||||
|
|
||||||
var requiredParams = Object.keys(params).filter(function (param) {
|
var requiredParams = Object.keys(params).filter(function (param) {
|
||||||
return params[param] === REQUIRED;
|
return params[param] === REQUIRED && !args[param];
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!requiredParams.length) {
|
if (!requiredParams.length) {
|
||||||
@ -337,6 +337,7 @@ var Bot = (function (_EventEmitter) {
|
|||||||
(function loop() {
|
(function loop() {
|
||||||
var next = iterator.next();
|
var next = iterator.next();
|
||||||
if (next.done) {
|
if (next.done) {
|
||||||
|
res.message.args = args;
|
||||||
ev.listener(res.message);
|
ev.listener(res.message);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -176,7 +176,7 @@ export default class Bot extends EventEmitter {
|
|||||||
let {params, args} = ev.parse(res.message.text);
|
let {params, args} = ev.parse(res.message.text);
|
||||||
|
|
||||||
const requiredParams = Object.keys(params).filter(param => {
|
const requiredParams = Object.keys(params).filter(param => {
|
||||||
return params[param] === REQUIRED;
|
return params[param] === REQUIRED && !args[param];
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!requiredParams.length) {
|
if (!requiredParams.length) {
|
||||||
@ -199,6 +199,7 @@ export default class Bot extends EventEmitter {
|
|||||||
(function loop() {
|
(function loop() {
|
||||||
const next = iterator.next();
|
const next = iterator.next();
|
||||||
if (next.done) {
|
if (next.done) {
|
||||||
|
res.message.args = args;
|
||||||
ev.listener(res.message);
|
ev.listener(res.message);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "telegram-api",
|
"name": "telegram-api",
|
||||||
"version": "0.5.00",
|
"version": "0.5.10",
|
||||||
"description": "Control Telegram bots easily using the new Telegram API",
|
"description": "Control Telegram bots easily using the new Telegram API",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
Loading…
Reference in New Issue
Block a user