Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const { VK } = require('vk-io');
const { SessionManager } = require('@vk-io/session');
const { SceneManager, StepScene } = require('@vk-io/scenes');
const vk = new VK({
token: process.env.TOKEN
});
const sessionManager = new SessionManager();
const sceneManager = new SceneManager();
sceneManager.addScene(new StepScene('signup', [
(context) => {
if (context.scene.step.firstTime || !context.text) {
return context.send('What\'s your name?');
}
context.scene.state.firstName = context.text;
return context.scene.step.next();
},
(context) => {
if (context.scene.step.firstTime || !context.text) {
return context.send('How old are you?');
}
const { VK } = require('vk-io');
const { SessionManager } = require('@vk-io/session');
const { SceneManager, StepScene } = require('@vk-io/scenes');
const vk = new VK({
token: process.env.TOKEN
});
const sessionManager = new SessionManager();
const sceneManager = new SceneManager();
sceneManager.addScene(new StepScene('signup', [
(context) => {
if (context.scene.step.firstTime || !context.text) {
return context.send('What\'s your name?');
}
context.scene.state.firstName = context.text;
return context.scene.step.next();
},
(context) => {
if (context.scene.step.firstTime || !context.text) {
return context.send('How old are you?');
}
context.scene.state.age = Number(context.text);