node-vk-bot-api
Advanced tools
Comparing version 2.4.3 to 2.4.5
@@ -12,21 +12,25 @@ class Stage { | ||
const { current, step } = ctx.session.__scene; | ||
const text = (ctx.message.text || ctx.message.body).toLowerCase(); | ||
const command = this.scenes[current].find(({ triggers }) => { | ||
if (!triggers) { | ||
return false; | ||
if (ctx.message.text || ctx.message.body) { | ||
const text = (ctx.message.text || ctx.message.body).toLowerCase(); | ||
const command = this.scenes[current].find(({ triggers }) => { | ||
if (!triggers) { | ||
return false; | ||
} | ||
return triggers.some(trigger => (trigger instanceof RegExp ? trigger.test(text) : text.startsWith(trigger))); | ||
}); | ||
if (command) { | ||
return command.fn(ctx); | ||
} | ||
} | ||
return triggers.some(trigger => (trigger instanceof RegExp ? trigger.test(text) : text.startsWith(trigger))); | ||
}); | ||
const simple = this.scenes[current][step]; | ||
if (!command && !simple) { | ||
return console.error(`Middleware not found for ${current} scene at ${step} step`); | ||
if (simple) { | ||
return simple.fn(ctx); | ||
} | ||
if (command) { | ||
return command.fn(ctx); | ||
} | ||
simple.fn(ctx); | ||
console.error(`Middleware not found for ${current} scene at ${step} step`); | ||
} | ||
@@ -33,0 +37,0 @@ |
{ | ||
"name": "node-vk-bot-api", | ||
"version": "2.4.3", | ||
"version": "2.4.5", | ||
"description": "🤖 VK bot framework for Node.js, based on Bots Long Poll API and Callback API", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 3 instances in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
33644
839
11