How to use the @vk-io/scenes.SceneManager function in @vk-io/scenes

To help you get started, we’ve selected a few @vk-io/scenes examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github negezor / vk-io / docs / examples / scene-bot.js View on Github external
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?');
		}

@vk-io/scenes

Scenes for the library vk-io

MIT
Latest version published 2 years ago

Package Health Score

48 / 100
Full package analysis